[CMake] Visual Studio Generator: different Link paths for Debug and Release

Hendrik Sattler post at hendrik-sattler.de
Wed Aug 25 10:57:36 EDT 2010


Zitat von aaron.meadows at thomsonreuters.com:
> I need to use different link paths for Debug and Release builds of my
> software.  I'm building with the Visual Studio Generator (2005, 2008,
> etc).  I had put this in my CMakeLists.txt, but as it turns out, this
> doesn't do what I need (likely because of the single pass to generate
> the project files):
>
> if(DEBUG)
>  link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Debug")
> else()
>  link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Release")
> endif()
>
> So, my question: is there a way to have different link directory paths
> for each configuration in visual studio without generating multiple
> build directories for VS?

I could tell you to use lib/${CMAKE_CFG_INTDIR} instead of lib/Debug  
and lib/Release. However, the names may not match what VS uses. The  
solution is to use full path to libraries with "debug ..... optimized  
...." syntax and completely forget about the existence of  
link_directories().

HS




More information about the CMake mailing list