On Tue, Jun 8, 2010 at 10:00 AM, Torri, Stephen CIV NSWCDD, W15 < stephen.to...@navy.mil> wrote:
> > From: Michael Wild [mailto:them...@gmail.com] > > Sent: Tue 6/8/2010 9:05 AM > > To: Torri, Stephen CIV NSWCDD, W15 > > Cc: cmake@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? No, that is not right. On the contrary: we recommend that you use full paths to libraries in target_link_libraries calls. > I don't think what you suggest will work: > > TARGET_LINK_LIBRARIES ( <target> <child libs> ${Boost_LIBRARIES} > ${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib ) > This should work. Do you have a problem with it if you try it? You can add debug and optimized versions like this (if those libraries exist): TARGET_LINK_LIBRARIES ( <target> <child libs> ${Boost_LIBRARIES} debug ${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib optimized ${MYSQLCPPCONNECTOR_LIB_DIR}/release/mysqlcppconn-static.lib ) Then, in multi-configuration generators (VS and Xcode), CMake links debug to debug and release to release... Or in a makefile based build, the value of CMAKE_BUILD_TYPE is used to determine which libraries to link to. HTH, David > 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 > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake