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:

Project/CMakeLists.txt
  -------------------------------------------------------
  ADD_SUBDIRECTORY(Foo)
  ADD_SUBDIRECTORY(Bar)
  -------------------------------------------------------

Project/Foo/CMakeLists.txt
  -------------------------------------------------------
  SET (LIBRARY Foo)
  # [...]
  GENERATE_PROJECT (${LIBRARY} "${SOURCE_FILES}" )
  ADD_LIBRARY (${LIBRARY} STATIC ${SOURCE_FILES})
  -------------------------------------------------------

Project/Bar/CMakeLists.txt
  -------------------------------------------------------
  # [...]
  ADD_EXECUTABLE (${BAR} ${SOURCE_FILES})
  TARGET_LINK_LIBRARIES(${FOO} ${BAR})
  -------------------------------------------------------

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:

=======================================================================
--- old_bar.vcproj
+++ new_bar.vcproj
=======================================================================
 <Configuration Name="RelWithDebInfo|Win32"
                OutputDirectory="RelWithDebInfo" [...]>
    [...]
    <Tool Name="VCLinkerTool"
          LinkLibraryDependencies="false"
          AdditionalOptions=" /STACK:10000000 /machine:I386 /debug"
          AdditionalDependencies="$(NOINHERIT) kernel32.lib user32.lib
-             gdi32.lib [...] ..\Foo\$(OutDir)\Foo.lib"
+             gdi32.lib [...] Foo.lib"
          [...]/>
 </Configuration>
=======================================================================

Any idea what might be causing this and/or what I could do to fix it?

Thanks,
-Edward
_______________________________________________
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

Reply via email to