Using wxWidgets from vcpkg in XCode

30 views
Skip to first unread message

Tim Burgess

unread,
Dec 30, 2025, 4:55:50 AM12/30/25
to wx-u...@googlegroups.com

Hi,

 

I’m working on an XCode project that was originally created to use wxWidgets from downloaded source. One of the goals is to use vcpkg for all of our libraries, so I installed the x64-osx and x64-osx-dynamic triplets then attempted to build the project.

 

The build fails, indicating that Xcode can’t find wx.h, even though I issued the ./vcpkg integrate install command. I suppose my questions are:

 

1 – What’s my best strategy for integrating wxWidgets from VCPKG into an Xcode project

 

2 – What do I do about the compiler and linker flags in my build settings?

 

Thanks for any advice.

 

Tim

 

 

 

Maarten Bent

unread,
Dec 30, 2025, 7:49:44 AM12/30/25
to wx-u...@googlegroups.com
Hi,

I'm not familiar with vcpkg on macOS with Xcode, but in general CMake will take care of creating the Xcode project and setting the correct compiler and linker flags. It needs the following two lines to find and link with wxWidgets (copied from vcpkg/ports/wxwidgets/usage):

find_package(wxWidgets CONFIG REQUIRED)
target_link_libraries(main PRIVATE wx::core wx::base)

And to make sure vcpkg is correctly initialized, I think you can check if the CMake variable VCPKG_TOOLCHAIN is set.
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wx-users/014901dc7972%2475adf680%246109e380%24%40raisedbar.net.

Tim Burgess

unread,
Dec 30, 2025, 10:39:12 AM12/30/25
to wx-u...@googlegroups.com

Hi Martin,

 

Thanks for the information but we don’t use cmake, I’m afraid.

 

Cheers.

 

Tim

Richard

unread,
Jan 5, 2026, 6:10:25 PMJan 5
to wx-u...@googlegroups.com
In article <000901dc79a2$6efe88b0$4cfb9a10$@raisedbar.net> you write:
>Thanks for the information but we don't use cmake, I'm afraid.

That makes your workflow more manual, but it doesn't fundamentally change
things.

vcpkg will download the dependencies, build them and install them into
vcpkg's tree when you're using it as a command-line tool,
e.g. "vcpkg install wxwidgets".

What you want to do is configure your Xcode project to pick up headers
and libraries from the install tree (not the build tree). By default,
vcpkg will typically build both debug and release versions of
dependencies to enable you to step through dependency code in the
debugger.

On my machine, with latest vcpkg, saying 'vcpkg install wxwidgets' put
stuff in $VCPKG/installed/x64-windows with subdirectories for lib,
include, etc.

All that should be necessary is that you set the <triplet>/include
directory in your include search path and the <triplet>/lib directory
in your library search path.

For wxWidgets on Windows, <triplet>/lib folder contains release libraries
and <triplet>/debug/lib contains debug libraries. Be aware that each
package decides for itself whether or not the debug library has a
different name than the release library (e.g. tiffd.lib on Windows for
debug and tiff.lib for release), so if you want to pick up both
configurations you'll need to manage those settings in Xcode
appropriately.

-- Richard

--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Reply all
Reply to author
Forward
0 new messages