2
votes

I installed cxWidgets as follows:

sudo install wxWidgets-3.0

In the cmake file of a project I am trying to build, find_package is called:

find_package(wxWidgets REQUIRED)

However, cmake complains that it can't find the package:

CMake Error at /opt/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS)

My question is, given that cxWidgets is installed (I have confirmed by running port installed), why can't cmake find it?

1
According to description in find script, it uses wx-config for locate libraries and include directories. Have you this utility installed and accessible? - Tsyvarev

1 Answers

2
votes

The problem is that MacPorts has to support multiple versions of wxWidgets and I have no good idea how to automatically let CMake find the requested version.

You have two options.

The first one is to run sudo port select wxWidgets wxWidgets-3.0. Then CMake should automatically find wxWidgets 3.0.

The second option is to add an additional argument to cmake that depends on the software you are trying to compile.

Usually one of these flags should work:

-DwxWidgets_CONFIG_EXECUTABLE=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config
-DwxWidgets_wxrc_EXECUTABLE=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wxrc