Using CMAKE with a custom configuration

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
mbeardsley
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Sep 25, 2014 7:40 pm

Using CMAKE with a custom configuration

Post by mbeardsley »

In addition to the normal "release" and "debug" configurations, I am trying to build a custom configuration but have been unable to get the wxWidgets FindPackage to give me the correct set of libraries (it keeps giving me the release versions and for this config I need the debug ones).

I suspect that the FindPackage is defaulting to release if it doesn't recognize the config type. I have tried setting the wxWidgets_CONFIGURATION variable and that can force it to use either the debug or release versions - but this then applies to all configurations.

What I need is to use the Release libraries for the Release config, and the Debug libraries for both the Debug and my custom config.

Furthermore, I have not found a way to set the wxWidgets_CONFIGURATION variable differently based on the "current" configuration. This seems to be a terrible oversight in CMAKE itself for multi-configuration generators (such as VisualStudio). Things like CMAKE_CONFIG_TYPE don't work for VisualStudio since it is building multiple types at once.

Does anyone know how to make this work, or how the FindWxWidgets.cmake determines which set of libraries to choose? I'm having a hard time trying to understand it. Thanks.

I am running WIN32 with VS2010 on Win7.
mbeardsley
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu Sep 25, 2014 7:40 pm

Re: Using CMAKE with a custom configuration

Post by mbeardsley »

Well, after a few more rounds of web searching, I found this that seems to work...

set_property( GLOBAL PROPERTY DEBUG_CONFIGURATIONS "Debug;MyCustomConfig")

This seems to tell any underlying find_library calls to look for the debug library versions for those configurations.

I had actually looked there before, but apparently that property defaults to NULL, even though one would think it would default to "Debug".
Apparently if the property is NULL, it assumes "Debug" is Debug and all others are Release.
If it is not NULL, only the configs listed are Debug, and all others are Release.

How one would get find_library to find a custom configuration library, I don't know. Fortunately I don't need to do that (for now anyway).
Post Reply