In your target_link_libraries statements, use:<br><br>- cmake target names to link to, if there are cmake targets for the linked-to libraries,<br>- full path file names for the libraries if there are not cmake targets for them<br>
<br>Are you doing that? If so, 2.6 and 2.8 should work the same.<br><br><br>HTH,<br>David<br><br><br><div class="gmail_quote">On Thu, Jun 10, 2010 at 2:34 PM, Ed Loper <span dir="ltr"><<a href="mailto:eloper@bbn.com">eloper@bbn.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I have a CMake project that works fine with CMake 2.6, but when I build Visual Studio output with CMake 2.8, it doesn't seem to get the target library linking information quite right. Here's a simplified version of my project:<br>
<br>
Project/CMakeLists.txt<br>
-------------------------------------------------------<br>
ADD_SUBDIRECTORY(Foo)<br>
ADD_SUBDIRECTORY(Bar)<br>
-------------------------------------------------------<br>
<br>
Project/Foo/CMakeLists.txt<br>
-------------------------------------------------------<br>
SET (LIBRARY Foo)<br>
# [...]<br>
GENERATE_PROJECT (${LIBRARY} "${SOURCE_FILES}" )<br>
ADD_LIBRARY (${LIBRARY} STATIC ${SOURCE_FILES})<br>
-------------------------------------------------------<br>
<br>
Project/Bar/CMakeLists.txt<br>
-------------------------------------------------------<br>
# [...]<br>
ADD_EXECUTABLE (${BAR} ${SOURCE_FILES})<br>
TARGET_LINK_LIBRARIES(${FOO} ${BAR})<br>
-------------------------------------------------------<br>
<br>
Under CMake 2.6, the Visual Studio project file for Bar would link to "..\Foo\$(OutDir)\Foo.lib". But under CMake 2.8, it tries to link to just "Foo.lib", and Visual Studio can't find it. In particular, the 'AdditionalDependencies' field in the vcproj file is different:<br>
<br>
=======================================================================<br>
--- old_bar.vcproj<br>
+++ new_bar.vcproj<br>
=======================================================================<br>
<Configuration Name="RelWithDebInfo|Win32"<br>
OutputDirectory="RelWithDebInfo" [...]><br>
[...]<br>
<Tool Name="VCLinkerTool"<br>
LinkLibraryDependencies="false"<br>
AdditionalOptions=" /STACK:10000000 /machine:I386 /debug"<br>
AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib<br>
- gdi32.lib [...] ..\Foo\$(OutDir)\Foo.lib"<br>
+ gdi32.lib [...] Foo.lib"<br>
[...]/><br>
</Configuration><br>
=======================================================================<br>
<br>
Any idea what might be causing this and/or what I could do to fix it?<br>
<br>
Thanks,<br>
-Edward<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>