[Cmake] Bug in 2.0.2: How to do configuration specific options in the MS Visual Studio Projects

Brad King brad.king at kitware.com
Thu Jul 29 08:40:35 EDT 2004


Rajiv Bhagwat wrote:
> The $(IntDir) chokes on ver 2.0.2, it works with 1.8.2, as used in the 
> following:
>  
> IF(CMAKE_GENERATOR MATCHES "Visual Studio")
>    TARGET_LINK_LIBRARIES(progname ${LIBBASE}/winbuild/$(IntDir)/libname.lib)
> ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
>    # Do something else to link the library.
> ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
> Btw, this is a very useful feature of the CMake system, please add this 
> ability of CMake to choose appropriate library (release/debug etc) 
> automatically as a tip to the documentation. I found this after reading 
> quite a few posts, and use of out-of-tree libraries is such a common 
> thing...

I just tried using this syntax and it works fine in 2.0.2.  What error 
did you get?

Either way, there is a more official way to solve this problem about 
which I had forgotten when I made the $(IntDir) suggestion.  Look at the 
documentation for TARGET_LINK_LIBRARIES:

   cmake --help-command TARGET_LINK_LIBRARIES

It describes how to use different libraries for "debug" and "optimized" 
builds.

-Brad


More information about the Cmake mailing list