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

Rajiv Bhagwat brajiv at giasbm01.vsnl.net.in
Thu Jul 29 11:13:51 EDT 2004


1. During 'configure', I get the error:
Parse error. Function missing ending ")". Instead found "("
indicating the line containing $(IntDir).

2. I had read about 'debug - optimised' modifiers. When tried, found the
following problems with it:

2a. How to get the lib for each of the 4 builds (Debug, Release, MinSizeRel
& RelWithDebInfo) is not very clear.. Two options-> Four combinations seems
ok, till you get: debug+optimised = RelWithDebInfo???
Use of a single modifier such as either of: D,R,M,I or 0-3 would be clearer.

2b. Testing with only 1 library, I used:
TARGET_LINK_LIBRARIES(progname libname debug )
Which crashed CMake with a big thud... Should I try 'progname debug
libname'? I assumed 'debug' would apply to the previous libname, the
document says otherwise.

2c. How exactly should the library path be specified if using the 'debug ..'
modifiers? i.e. Would CMake not have to figure out the directory and insert
it in path just before '/libname.lib'?
i.e. use of
TARGET_LINK_LIBRARIES(progname ${PRJ_PATH}/winbuild/libname.lib)
instead of:
TARGET_LINK_LIBRARIES(progname ${PRJ_PATH}/winbuild/$(IntDir)/libname.lib)
appears confusing, when we know that there is an option dependant directory
in-between.

Have been playing with CMake for 6 months or so, but space+time
considerations of compiling every library as a part of every project was not
very attractive...
- Rajiv


----- Original Message -----
From: "Brad King" <brad.king at kitware.com>
To: "Rajiv Bhagwat" <brajiv at giasbm01.vsnl.net.in>
Cc: <cmake at www.cmake.org>
Sent: Thu, 29 Jul 2004 6:10 PM
Subject: Re: [Cmake] Bug in 2.0.2: How to do configuration specific options
inthe MS Visual Studio Projects


> 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