Hi All,

I am trying to build a project containing several subprojects that are included via add_subdirectory. Now, here is an example demonstrating the problem:

The test project contains the following CMakeLists.txt:
----
project( CMakeTest )
cmake_minimum_required( VERSION 2.6 )

add_subdirectory( libFoo )

add_executable( TestApp main.cpp )
target_link_libraries( TestApp libFoo )
----

The CMakeLists.txt of the subdirectory libFoo:
----
add_library( iLib SHARED IMPORTED )
set_target_properties( iLib PROPERTIES IMPORTED_LOCATION "/opt/local/ lib/libzip.dylib" )

add_library( libFoo SHARED foo.cpp )
target_link_libraries( libFoo iLib )
----

According to the documentation, the imported target (iLib) is only know within libFoo and its subdirectories. So, when I try to link 'TestApp', it fails because the linker is looking for 'iLib' rather than '/opt/local/lib/libzip.dylib' due transitive linking (I suspect).

Is that intended behavior?

Best regards,
Tobias
_______________________________________________
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