[CMake] Issue w/ relative library paths between targets in CMake 2.8 / Visual Studio 9 2008
David Cole
david.cole at kitware.com
Thu Jun 10 16:18:08 EDT 2010
In your target_link_libraries statements, use:
- cmake target names to link to, if there are cmake targets for the
linked-to libraries,
- full path file names for the libraries if there are not cmake targets for
them
Are you doing that? If so, 2.6 and 2.8 should work the same.
HTH,
David
On Thu, Jun 10, 2010 at 2:34 PM, Ed Loper <eloper at bbn.com> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100610/adc8f135/attachment-0001.htm>
More information about the CMake
mailing list