[CMake] Problems with target_link_libraries picking up both sets of libraries
Jesse Perla
jesseperla at gmail.com
Tue Feb 24 23:19:51 EST 2009
I am using cmake 2.6.3 on vista.
I am having trouble with the target_link_libraries appearing to not picking
up the right libraries in visual studio and nmake when I use "debug" and
"optimized"It appears to add both sets of libraries in many cases. I
haven't been able to detect clear patterns with it, but my cmakelists.txt
have been very simple.
When I turn on verbose makefiles and use nmake, it seems to be including
both the debug and release libraries. And in visual studio, the debug and
release targets have all of the libraries in the library includes. Am I
doing something wrong ehre?
My package just sets a couple of variables called ETK_... . I used message
to make sure that they are filled with the right versions of the files.
My code looks like this:
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH $ENV{ETK_BUILD} )
find_package(ETK)
project(hello_scl)
set(libscl_INCLUDE c:/working/libraries/trunk/examples/cmake_example/libscl)
#point to headers.
include_directories(${ETK_INCLUDE_DIRS} ${libscl_INCLUDE})
link_directories(${ETK_LIBRARY_DIRS})
#Setup the executable and add the source
set(hello2_SRCS
hello-scl.cpp)
add_executable(hello2 ${hello2_SRCS})
message("The debug libraries are ${ETK_DEBUG_LIBRARIES}")
message("The release libraries are ${ETK_RELEASE_LIBRARIES}")
target_link_libraries(hello2
debug ${ETK_DEBUG_LIBRARIES} scl-d.lib)
target_link_libraries(hello2
optimized ${ETK_RELEASE_LIBRARIES} scl.lib)
Also, sometimes when I have only added an executable target, it also builds
a library, which I find puzzling.
[100%] Building CXX object CMakeFiles/hello2.dir/hello-scl.cpp.obj
hello-scl.cpp
Linking CXX executable hello2.exe
Creating library hello2.lib and object hello2.exp
[100%] Built target hello2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090224/3669a91a/attachment-0001.htm>
More information about the CMake
mailing list