[EMAIL PROTECTED] wrote:
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"
Have you tried 'target_link_libraries( ${TEST_EXECUTABLE} libA )'? This
WFM in my own project. I build two libraries (we'll call them 'foo' and
'bar'), in src/foo and src/bar, and have a test suite in src/test. 'bar'
has 'target_link_libraries(bar foo)' and my macro for building test
programs has 'target_link_libraries(${test} foo bar)'.
--
Matthew
Obscurity: +5
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake