[CMake] Different configurations for Debug and Release
Torri, Stephen CIV NSWCDD, W15
stephen.torri at navy.mil
Tue Jun 8 10:00:49 EDT 2010
> From: Michael Wild [mailto:themiwi at gmail.com]
> Sent: Tue 6/8/2010 9:05 AM
> To: Torri, Stephen CIV NSWCDD, W15
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Different configurations for Debug and Release
>
>
> > In my project the external libraries I use have the debug library files are in a different directory from the release versions. > > I don't think I can use target_link_libraries to include a path as well as the name. In documentation I would use > > link_directories but there is no way in the syntax to distinguish a debug directory from a release directory. I am trying > > to generate a Visual Studio project that can build a debug release if I select "Debug" in the configuration manager drop > > down menu or "Release". Is there a way for me to tell CMake that a certain set of directories the linker should use to > > search for files for the debug build versus another?
> >
> > Stephen
> >
>
> Either use
>
> target_link_libraries(<target> debug <debug_lib> optimized <opt_lib> general <gen_lib>)
>
> or, for more control, create an imported library (add_library(<lib_target> IMPORTED)) and set the > IMPORTED_LOCATION_<config> target properties to specify the location on the disk for each of the configurations > you want to handle.
I did not think that I could use a full path to a library in the TARGET_LINK_LIBRARIES. Is that right? I don't think what you suggest will work:
TARGET_LINK_LIBRARIES ( <target> <child libs> ${Boost_LIBRARIES}
${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib )
So I was looking at add_library. I am not sure I get the IMPORTED_LOCATION_<config>. First off what can I use for <config>? I tried IMPORTED_LOCATION_DEBUG but that gave me an error from cmake-gui saying its was an unknown cmake command. The documentation does not clearly define what <config> is other than stating its a configuration. Can you provide a simple example of what you are suggesting?
Stephen
More information about the CMake
mailing list