<div>I am using cmake 2.6.3 on vista.</div><div><br></div>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"<div>
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.<br></div><div><div>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?</div>
<div><br></div><div>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.</div><div><br></div><div>My code looks like this:</div>
<div><div>cmake_minimum_required(VERSION 2.6)</div><div>set(CMAKE_MODULE_PATH $ENV{ETK_BUILD} )</div><div>find_package(ETK)</div><div><br></div><div>project(hello_scl)</div><div>set(libscl_INCLUDE c:/working/libraries/trunk/examples/cmake_example/libscl) #point to headers.</div>
<div>include_directories(${ETK_INCLUDE_DIRS} ${libscl_INCLUDE})</div><div>link_directories(${ETK_LIBRARY_DIRS})</div><div><br></div><div>#Setup the executable and add the source</div><div>set(hello2_SRCS</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>hello-scl.cpp)</div>
<div>add_executable(hello2 ${hello2_SRCS})</div><div>message("The debug libraries are ${ETK_DEBUG_LIBRARIES}")</div><div>message("The release libraries are ${ETK_RELEASE_LIBRARIES}")</div><div><br></div>
<div>target_link_libraries(hello2</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>debug ${ETK_DEBUG_LIBRARIES} scl-d.lib)</div><div>target_link_libraries(hello2</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>optimized ${ETK_RELEASE_LIBRARIES} scl.lib)</div>
</div><div><br></div><div>Also, sometimes when I have only added an executable target, it also builds a library, which I find puzzling.<br></div><div><br></div><div>[100%] Building CXX object CMakeFiles/hello2.dir/hello-scl.cpp.obj</div>
<div>hello-scl.cpp</div><div>Linking CXX executable hello2.exe</div><div> Creating library hello2.lib and object hello2.exp</div><div>[100%] Built target hello2</div></div><div><br></div>