[CMake] Linking installed libraries on a "sub" CMakeLists

d0b3rM4n at gmx.net d0b3rM4n at gmx.net
Tue Apr 3 06:15:07 EDT 2007


Hi Gerhard,

> ...
> target_link_libraries( ${TEST_EXECUTABLE} libA )
> ...

works fine !

Thanks,
Gerhard
-------- Original-Nachricht --------
Datum: Tue, 3 Apr 2007 10:25:23 +0200
Von: "Gerhard Grimm" <ggrimm at detec.de>
An: d0b3rM4n at gmx.net, cmake at cmake.org
Betreff: AW: [CMake] Linking installed libraries on a "sub" CMakeLists

> Hi Gerhard,
> 
> I'd suggest to replace
> 
> ...
> set ( LIBA_LIBRARY ${TEST_LIB_INSTALL_DIR}/liblibA.a )
> target_link_libraries( ${TEST_EXECUTABLE} ${LIBA_LIBRARY} )
> ...
> 
> with
> 
> ...
> target_link_libraries( ${TEST_EXECUTABLE} libA )
> ...
> 
> That should do the trick!
> 
> 
> Best regards,
> 
> Gerhard
> 
> -----Ursprüngliche Nachricht-----
> Von: cmake-bounces+ggrimm=detec.de at cmake.org
> [mailto:cmake-bounces+ggrimm=detec.de at cmake.org]Im Auftrag von
> d0b3rM4n at gmx.net
> Gesendet: Dienstag, 3. April 2007 10:06
> An: cmake at cmake.org
> Betreff: [CMake] Linking installed libraries on a "sub" CMakeLists
> 
> 
> Hi all
> 
> I'm using cmake to compile lots of different libs under linux, with
> add_subdirectory.
> I want to install the libs and headers in a directory
> ${CMAKE_BINARY_DIR}/dist/lib and ${CMAKE_BINARY_DIR}/dist/include
> 
> My root CMakeLists.txt file:
> project(testproject)
> 
> add_subdirectory( libA )
> add_subdirectory( libB )
> ...
> add_subdirectory( testApplication )
> 
> 
> 
> 
> My libA CMakeLists.txt file:
> ...
> install(TARGETS libA DESTINATION ${TEST_LIB_INSTALL_DIR} )
> install(FILES libA.h DESTINATION ${TEST_INCLUDE_INSTALL_DIR} )
> ...
> 
> 
> In my testApplication I want to link againt some libraries and I need the
> installed header files.
> ...
> include_directories ( ${TEST_INCLUDE_INSTALL_DIR} )
> link_directories ( ${TEST_LIB_INSTALL_DIR} )
> ...
> 
> ...
> set ( LIBA_LIBRARY ${TEST_LIB_INSTALL_DIR}/liblibA.a )
> target_link_libraries( ${TEST_EXECUTABLE} ${LIBA_LIBRARY} )
> ...
>  
> When I call cmake from my project root directory, I get the following
> error.
> CMake Error: Attempt to add link library
> "/home/cmaketests/final/dist/lib/liblibA.a" to target "testApplication" which is not built by this project.
> CMake Error: Cannot find source file
> "/home/cmaketests/final/dist/lib/liblibA.a" for target "testApplication"
> 
> 
> Any ideas ? 
> Thanks all.
> Gerhard
> -- 
> 
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail


More information about the CMake mailing list