[CMake] how to find current Windows build configuration?
Kent Williams
nkwmailinglists at gmail.com
Wed Oct 24 09:57:17 EDT 2012
On platforms other than Windows, the build type is a single value
stored in CMAKE_BUILD_TYPE, and can be accessed if you want your build
to different things in Debug, Release, etc modes.
On Windows with Visual Studio, there's a variable
CMAKE_CONFIGURATION_TYPE that is a list of the builds that will be
done.
How do I recover the actual, current build type?
The reason I need to do this: I need to import libraries built in an
ExternalProject. On OS X or Linux, the libraries generated by the
ExternalProject are in one predictable place.
So I can do this:
set(EP_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/${EP_NAME}-build/lib)
On windows this will need to be
# fictional variable WINDOWS_CURRENT_BUILD_TYPE giving current build type
set(EP_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/${EP_NAME}-build/${WINDOWS_CURRENT_BUILD_TYPE})
Unfortunately, there's no such variable. And, given how Visual Studio
works, where you can have a build that actually builds any number of
build_types at one go, I'm not sure how to handle this.
One thought I had was to always build the External Project as Release
on Windows; then the libraries are someplace predictable.
More information about the CMake
mailing list