Clinton Stimpson wrote: > I have an example (attached)
The example becomes more readable and easier to reason about by applying this patch: diff --git a/CMakeLists.txt b/CMakeLists.txt index 89a415d..15bfb46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 2.8) -cmake_policy(SET CMP0022 OLD) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--as-needed") set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") @@ -10,19 +8,15 @@ set_target_properties(shareda PROPERTIES LIBRARY_OUTPUT_DIRECTORY "subdir") add_library(sharedb SHARED sharedb.cpp) set_target_properties(sharedb PROPERTIES LIBRARY_OUTPUT_DIRECTORY "subdir") -target_link_libraries(sharedb shareda) -set_target_properties(sharedb PROPERTIES LINK_INTERFACE_LIBRARIES "") +target_link_libraries(sharedb PUBLIC shareda) set_target_properties(sharedb PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_RPATH "") add_library(static STATIC static.cpp) -target_link_libraries(static sharedb) +target_link_libraries(static PUBLIC sharedb) set_target_properties(static PROPERTIES COMPILE_FLAGS "-fPIC") add_library(shared2 SHARED shared2.cpp) -target_link_libraries(shared2 static) -set_target_properties(shared2 PROPERTIES LINK_INTERFACE_LIBRARIES "") +target_link_libraries(shared2 PRIVATE static) add_executable(exe exe.cpp) target_link_libraries(exe shared2) - - Thanks, Steve. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
