[CMake] Release and Debug build linking

Lee Butler iraytrace at gmail.com
Tue Oct 6 16:21:38 EDT 2015


I am looking for a way to tell my project to link against external debug 
libraries with a debug build and external release libraries with a 
release build with Visual Studio.

I sort of want to be able to say something like
if (BuildingReleaseConfig)
find_package(OtherPackage REQUIRED COMPONENTS one two three PATHS 
OtherPkgDir/Release)
endif()

if (BuildingDebugConfig)
find_package(OtherPackage REQUIRED COMPONENTS oned twod threed PATHS 
OtherPkgDir/Debug)
endif()

the idea is that the if () tells CMake which build configuration the 
find_package results should go into.  Is there any way to tell CMake 
what to write into each VS configuration?

I realize the traditional CMake way is to create only one build at a 
time and specify CMAKE_BUILD_TYPE, but we seem to have stepped beyond 
that with the Visual Studio generator.

Lee


More information about the CMake mailing list