diff --git a/Base/CMakeLists.txt b/Base/CMakeLists.txt index b69f251068bad2c4ade38bab6652f7cab6d103c5..4eba20015258674efb859cdf21ce94b20f606ee5 100644 --- a/Base/CMakeLists.txt +++ b/Base/CMakeLists.txt @@ -25,6 +25,7 @@ target_include_directories(${lib} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIRS} ) target_link_libraries(${lib} + PRIVATE ${GSL_LIBRARIES} ${FFTW3_LIBRARIES} ${Boost_LIBRARIES} diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 635132511ffdc34debcb856aa87013f0c60e37da..728a3b6fac17fe9c9d67e8f2546095c8a9c540d6 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -18,10 +18,14 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE) # --- external dependencies --- -target_link_libraries(${lib} +target_link_libraries(${lib} + PUBLIC ${BornAgainSample_LIBRARY} ${BornAgainDevice_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT}) + PRIVATE + ${CMAKE_THREAD_LIBS_INIT} + ${tspectrum_LIBRARY} + ${Cerf_LIBRARIES}) target_include_directories(${lib} PUBLIC ${CMAKE_SOURCE_DIR} @@ -29,11 +33,9 @@ target_include_directories(${lib} ${Cerf_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty/Core/ # TEMPORARY ) -target_link_libraries(${lib} - ${tspectrum_LIBRARY} ${Cerf_LIBRARIES}) if(BORNAGAIN_MPI) add_definitions(-DBORNAGAIN_MPI) include_directories(${MPI_INCLUDE_PATH}) - target_link_libraries(${lib} ${MPI_LIBRARIES}) + target_link_libraries(${lib} PUBLIC ${MPI_LIBRARIES}) endif() diff --git a/Device/CMakeLists.txt b/Device/CMakeLists.txt index 40a89034bfb97940e3023e2537429cbbf5bdb1d6..123d6209a2ef18a6316eb3176098bac7e063a14d 100644 --- a/Device/CMakeLists.txt +++ b/Device/CMakeLists.txt @@ -18,10 +18,14 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE) # --- external dependencies --- -target_link_libraries(${lib} +target_link_libraries(${lib} + PUBLIC ${BornAgainSample_LIBRARY} # TODO get rid of this dependence ${BornAgainParam_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT}) + ${CMAKE_THREAD_LIBS_INIT} + PRIVATE + ${FFTW3_LIBRARIES}) + target_include_directories(${lib} PUBLIC ${CMAKE_SOURCE_DIR} ) @@ -30,7 +34,7 @@ target_include_directories(${lib} PUBLIC ${CMAKE_SOURCE_DIR} ${tspectrum_INCLUDE_DIR} ) -target_link_libraries(${lib} +target_link_libraries(${lib} PUBLIC ${tspectrum_LIBRARY} ) @@ -40,5 +44,5 @@ endif() if(BORNAGAIN_TIFF_SUPPORT) target_compile_definitions(${lib} PUBLIC -DBORNAGAIN_TIFF_SUPPORT) target_include_directories(${lib} PUBLIC ${TIFF_INCLUDE_DIR}) - target_link_libraries(${lib} ${TIFF_LIBRARIES}) + target_link_libraries(${lib} PUBLIC ${TIFF_LIBRARIES}) endif() diff --git a/Fit/CMakeLists.txt b/Fit/CMakeLists.txt index 72620b94777654d90798c8999ddd30a1d7967ce0..68708ffb0da5f5bdfb0e33ed65214f2429cc01c6 100644 --- a/Fit/CMakeLists.txt +++ b/Fit/CMakeLists.txt @@ -20,4 +20,8 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE) target_include_directories(${lib} PUBLIC ${RootMinimizers_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}) -target_link_libraries(${lib} ${RootMinimizers_LIBRARY} ${Boost_LIBRARIES} ${Boost_Additional_Libraries}) +target_link_libraries(${lib} + PUBLIC + ${RootMinimizers_LIBRARY} + ${Boost_LIBRARIES} + ${Boost_Additional_Libraries}) diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index 10792fb54bc38097e5860ae801feafc8698e61fd..2d89d55d0a93be79195adb6d5e77be3d9b6ea490 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -108,11 +108,13 @@ target_compile_definitions(${library_name} PUBLIC $<$<NOT:$<CONFIG:Debug>>:QT_NO target_include_directories(${library_name} PUBLIC ${CMAKE_SOURCE_DIR}) target_link_libraries(${library_name} + PUBLIC ${BornAgainCore_LIBRARY} ${ba3d_LIBRARY} Qt5::Widgets Qt5::Core Qt5::Gui + PRIVATE Qt5::Designer Qt5::PrintSupport qcustomplot diff --git a/GUI/main/CMakeLists.txt b/GUI/main/CMakeLists.txt index 0e0300084e3f2e309a76f8105b627c1eacf6eccb..9f7aa866760259ff0cc7f95aeef485a9cdb3f0d6 100644 --- a/GUI/main/CMakeLists.txt +++ b/GUI/main/CMakeLists.txt @@ -42,8 +42,8 @@ add_executable(${executable_name} # ----------------------------------------------------------------------------- # dependencies # ----------------------------------------------------------------------------- -target_link_libraries(${executable_name} ${BornAgainGUI_LIBRARY}) -target_include_directories(${executable_name} PUBLIC ${BornAgainGUI_INCLUDE_DIRS}) +target_link_libraries(${executable_name} ${BornAgainGUI_LIBRARY} ${Boost_LIBRARIES}) +target_include_directories(${executable_name} PUBLIC ${BornAgainGUI_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) # ----------------------------------------------------------------------------- # extra target properties diff --git a/Param/CMakeLists.txt b/Param/CMakeLists.txt index cd62f879b5fc8bef3e200ae5022b75a531a1f742..e1e0d33863ef3b37840b73a5177794a09d91bc0b 100644 --- a/Param/CMakeLists.txt +++ b/Param/CMakeLists.txt @@ -19,6 +19,7 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE) # --- external dependencies --- target_link_libraries(${lib} + PUBLIC ${BornAgainBase_LIBRARY} ${BornAgainFit_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/Sample/CMakeLists.txt b/Sample/CMakeLists.txt index f72133dfc7f61e9c1d3d29d8323b8f059b71a823..0d8f727fadea6542b97b8d49fc170ffda27f3bf0 100644 --- a/Sample/CMakeLists.txt +++ b/Sample/CMakeLists.txt @@ -19,6 +19,7 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE) # --- external dependencies --- target_link_libraries(${lib} + PRIVATE ${BornAgainParam_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(${lib} diff --git a/Tests/Functional/PyEmbedded/CMakeLists.txt b/Tests/Functional/PyEmbedded/CMakeLists.txt index dfcf617640697e58b21b861bf050534331b3a173..e42ea93cc8cf21e1be81c6db2cc49ef77f12b431 100644 --- a/Tests/Functional/PyEmbedded/CMakeLists.txt +++ b/Tests/Functional/PyEmbedded/CMakeLists.txt @@ -13,6 +13,6 @@ target_include_directories(${test} ${CMAKE_SOURCE_DIR}/auto/Wrap ) -target_link_libraries(${test} BornAgainCore gtest) +target_link_libraries(${test} BornAgainCore gtest ${Python3_LIBRARIES}) gtest_discover_tests(${test}) diff --git a/cmake/BornAgain/SwigLib.cmake b/cmake/BornAgain/SwigLib.cmake index 1513b5e1c459509b14e8aa300148e99e48fc4329..f86ccd99a4db13adb6171c12ea2ef4ce83ea583f 100644 --- a/cmake/BornAgain/SwigLib.cmake +++ b/cmake/BornAgain/SwigLib.cmake @@ -76,8 +76,8 @@ function(SwigLib name lib TMP_DIR) add_dependencies(${lib} ${lib}_python) target_compile_definitions(${lib} PUBLIC -DBORNAGAIN_PYTHON) - target_include_directories(${lib} PUBLIC ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS}) - target_link_libraries(${lib} ${Python3_LIBRARIES}) + target_include_directories(${lib} PRIVATE ${Python3_INCLUDE_DIRS} ${Python3_NumPy_INCLUDE_DIRS}) + target_link_libraries(${lib} PRIVATE ${Python3_LIBRARIES}) install(FILES ${CMAKE_BINARY_DIR}/lib/lib${lib}.py DESTINATION ${destination_lib} COMPONENT Libraries) # required by swig