Commit 1af41d70 authored by Ghislain MARY's avatar Ghislain MARY

Do not include dependencies in the link interface when building a shared library.

parent 75de608e
......@@ -87,9 +87,9 @@ if(ENABLE_STATIC)
endif()
if(ENABLE_SHARED)
add_library(bctoolbox SHARED ${BCTOOLBOX_SOURCE_FILES})
target_link_libraries(bctoolbox ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(bctoolbox PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(WIN32)
target_link_libraries(bctoolbox "Winmm" "Ws2_32")
target_link_libraries(bctoolbox PRIVATE "Winmm" "Ws2_32")
target_compile_definitions(bctoolbox PRIVATE "-DBCTBX_EXPORTS")
endif()
set_target_properties(bctoolbox PROPERTIES LINKER_LANGUAGE "CXX")
......@@ -108,12 +108,12 @@ if(ENABLE_SHARED)
endif()
endif()
if(HAVE_LIBRT)
target_link_libraries(bctoolbox rt)
target_link_libraries(bctoolbox PRIVATE rt)
endif()
if(CUNIT_FOUND)
add_library(bctoolbox-tester SHARED ${BCTOOLBOX_TESTER_SOURCE_FILES})
set_target_properties(bctoolbox-tester PROPERTIES LINKER_LANGUAGE "CXX")
target_link_libraries(bctoolbox-tester bctoolbox)
target_link_libraries(bctoolbox-tester PRIVATE bctoolbox)
if(WIN32)
target_compile_definitions(bctoolbox-tester PRIVATE "-DBCTBX_EXPORTS")
endif()
......@@ -142,7 +142,7 @@ if(MBEDTLS_FOUND)
endif()
if(ENABLE_SHARED)
target_include_directories(bctoolbox PUBLIC ${MBEDTLS_INCLUDE_DIRS})
target_link_libraries(bctoolbox ${MBEDTLS_LIBRARIES})
target_link_libraries(bctoolbox PRIVATE ${MBEDTLS_LIBRARIES})
endif()
endif()
if(POLARSSL_FOUND)
......@@ -152,7 +152,7 @@ if(POLARSSL_FOUND)
endif()
if(ENABLE_SHARED)
target_include_directories(bctoolbox PUBLIC ${POLARSSL_INCLUDE_DIRS})
target_link_libraries(bctoolbox ${POLARSSL_LIBRARIES})
target_link_libraries(bctoolbox PRIVATE ${POLARSSL_LIBRARIES})
endif()
endif()
if(CUNIT_FOUND)
......@@ -162,7 +162,7 @@ if(CUNIT_FOUND)
endif()
if(ENABLE_SHARED)
target_include_directories(bctoolbox-tester PUBLIC ${CUNIT_INCLUDE_DIRS})
target_link_libraries(bctoolbox-tester ${CUNIT_LIBRARIES})
target_link_libraries(bctoolbox-tester PRIVATE ${CUNIT_LIBRARIES})
endif()
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment