From 9a50532b1f1fa55b4f0b668abfc5947b88f8f87b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 7 Aug 2014 14:22:42 -0700 Subject: [PATCH] bubble up sub dependencies to link_hifi_library --- cmake/macros/LinkHifiLibrary.cmake | 2 +- interface/CMakeLists.txt | 6 ------ libraries/octree/CMakeLists.txt | 10 ++++++++-- libraries/shared/CMakeLists.txt | 5 ++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cmake/macros/LinkHifiLibrary.cmake b/cmake/macros/LinkHifiLibrary.cmake index 6300e50c34..577f0c9f37 100644 --- a/cmake/macros/LinkHifiLibrary.cmake +++ b/cmake/macros/LinkHifiLibrary.cmake @@ -16,7 +16,7 @@ macro(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR) include_directories("${ROOT_DIR}/libraries/${LIBRARY}/src") add_dependencies(${TARGET} ${LIBRARY}) - target_link_libraries(${TARGET} ${LIBRARY}) + target_link_libraries(${TARGET} ${LIBRARY} ${REQUIRED_DEPENDENCY_LIBRARIES}) if (APPLE) # currently the "shared" library requires CoreServices diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 7336b55852..5c1bec0321 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -126,7 +126,6 @@ find_package(LeapMotion) find_package(ZLIB) find_package(Qxmpp) find_package(RtMidi) -find_package(OpenSSL REQUIRED) # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) @@ -180,14 +179,9 @@ endif () # include headers for interface and InterfaceConfig. include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes") -# include external library headers -# use system flag so warnings are supressed -include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") - target_link_libraries( ${TARGET_NAME} "${ZLIB_LIBRARIES}" - ${OPENSSL_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Multimedia Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Svg Qt5::WebKit Qt5::WebKitWidgets Qt5::Xml Qt5::UiTools ) diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index 031f7ef69a..398bf80157 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -20,9 +20,15 @@ link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}") # link ZLIB find_package(ZLIB) +find_package(OpenSSL REQUIRED) -include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets) +include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${OPENSSL_INCLUDE_DIR}") + +# bubble up the libraries we are dependent on +set(REQUIRED_DEPENDENCY_LIBRARIES ${REQUIRED_DEPENDENCY_LIBRARIES} + "${ZLIB_LIBRARIES}" "${OPENSSL_LIBRARIES}" Qt5::Widgets PARENT_SCOPE) + +target_link_libraries(${TARGET_NAME} ${REQUIRED_DEPENDENCY_LIBRARIES}) # add a definition for ssize_t so that windows doesn't bail if (WIN32) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index f099f424e9..c0d59c8b75 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -30,4 +30,7 @@ endif (UNIX AND NOT APPLE) # directory when Qt5 (5.2.1) is compiled from source and is not in a standard place. include_directories(SYSTEM "${Qt5Script_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets) +# bubble up the libraries we are dependent on and link them to ourselves +set(REQUIRED_DEPENDENCY_LIBRARIES Qt5::Network Qt5::Widgets) +set(SUB_DEPENDENCY_LIBRARIES ${REQUIRED_DEPENDENCY_LIBRARIES} PARENT_SCOPE) +target_link_libraries(${TARGET_NAME} ${REQUIRED_DEPENDENCY_LIBRARIES}) \ No newline at end of file