From b5c8a4d2c635d4788b7c7fc6597293861fe66849 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 7 Aug 2014 15:47:57 -0700 Subject: [PATCH] fix requirement of networking in audio library --- cmake/macros/LinkHifiLibrary.cmake | 9 ++++++++- libraries/animation/CMakeLists.txt | 9 ++++++--- libraries/audio/CMakeLists.txt | 7 +++++++ libraries/embedded-webserver/CMakeLists.txt | 8 ++++---- libraries/fbx/CMakeLists.txt | 6 +++++- libraries/metavoxels/CMakeLists.txt | 10 +++++++--- libraries/models/CMakeLists.txt | 11 +---------- libraries/networking/CMakeLists.txt | 13 ++++--------- libraries/shared/CMakeLists.txt | 10 +++++----- 9 files changed, 47 insertions(+), 36 deletions(-) diff --git a/cmake/macros/LinkHifiLibrary.cmake b/cmake/macros/LinkHifiLibrary.cmake index afb1f1febd..227ddf066a 100644 --- a/cmake/macros/LinkHifiLibrary.cmake +++ b/cmake/macros/LinkHifiLibrary.cmake @@ -17,5 +17,12 @@ macro(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR) add_dependencies(${TARGET} ${LIBRARY}) - target_link_libraries(${TARGET} ${LIBRARY} ${SUB_DEPENDENCY_LIBRARIES}) + get_target_property(LINKED_TARGET_DEPENDENCY_LIBRARIES ${LIBRARY} DEPENDENCY_LIBRARIES) + + if (LINKED_TARGET_DEPENDENCY_LIBRARIES) + target_link_libraries(${TARGET} ${LIBRARY} ${LINKED_TARGET_DEPENDENCY_LIBRARIES}) + else () + target_link_libraries(${TARGET} ${LIBRARY}) + endif () + endmacro(LINK_HIFI_LIBRARY _library _target _root_dir) \ No newline at end of file diff --git a/libraries/animation/CMakeLists.txt b/libraries/animation/CMakeLists.txt index be6ed47898..20f4a59181 100644 --- a/libraries/animation/CMakeLists.txt +++ b/libraries/animation/CMakeLists.txt @@ -6,8 +6,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm set(TARGET_NAME animation) -find_package(Qt5 COMPONENTS Script) - include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) @@ -15,7 +13,12 @@ include(${MACRO_DIR}/LinkHifiLibrary.cmake) link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}") link_hifi_library(fbx ${TARGET_NAME} "${ROOT_DIR}") -target_link_libraries(${TARGET_NAME} Qt5::Script) +find_package(Qt5Script) + +# set a property indicating the libraries we are dependent on and link them to ourselves +set(DEPENDENCY_LIBRARIES Qt5::Script) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}") +target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES}) # add a definition for ssize_t so that windows doesn't bail if (WIN32) diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt index 2ad8a4b0bc..69cc61ca6d 100644 --- a/libraries/audio/CMakeLists.txt +++ b/libraries/audio/CMakeLists.txt @@ -20,6 +20,13 @@ include(${MACRO_DIR}/LinkHifiLibrary.cmake) link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}") link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}") +find_package(Qt5Network) + +# set a property indicating the libraries we are dependent on and link them to ourselves +set(DEPENDENCY_LIBRARIES Qt5::Network) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES}) +target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES}) + # add a definition for ssize_t so that windows doesn't bail if (WIN32) add_definitions(-Dssize_t=long) diff --git a/libraries/embedded-webserver/CMakeLists.txt b/libraries/embedded-webserver/CMakeLists.txt index f1681cdd12..eb28cae1b3 100644 --- a/libraries/embedded-webserver/CMakeLists.txt +++ b/libraries/embedded-webserver/CMakeLists.txt @@ -11,7 +11,7 @@ setup_hifi_library(${TARGET_NAME}) find_package(Qt5Network REQUIRED) -# bubble up the libraries we are dependent on and link them to ourselves -set(REQUIRED_DEPENDENCY_LIBRARIES Qt5::Network) -set(SUB_DEPENDENCY_LIBRARIES ${REQUIRED_DEPENDENCY_LIBRARIES} PARENT_SCOPE) -target_link_libraries(${TARGET_NAME} ${REQUIRED_DEPENDENCY_LIBRARIES}) \ No newline at end of file +# set a property indicating the libraries we are dependent on and link them to ourselves +set(DEPENDENCY_LIBRARIES Qt5::Network) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES}) +target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES}) \ No newline at end of file diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index 45d1051dc6..a125de1320 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -22,7 +22,11 @@ link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}") find_package(ZLIB) include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets) + +# bubble up the libraries we are dependent on and link them to ourselves +set(REQUIRED_DEPENDENCY_LIBRARIES "${ZLIB_LIBRARIES}") +set(SUB_DEPENDENCY_LIBRARIES ${REQUIRED_DEPENDENCY_LIBRARIES} 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/metavoxels/CMakeLists.txt b/libraries/metavoxels/CMakeLists.txt index c79631ce06..c419f664a0 100644 --- a/libraries/metavoxels/CMakeLists.txt +++ b/libraries/metavoxels/CMakeLists.txt @@ -6,8 +6,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cm set(TARGET_NAME metavoxels) -find_package(Qt5 COMPONENTS Network Script Widgets) - include(${MACRO_DIR}/AutoMTC.cmake) auto_mtc(${TARGET_NAME} "${ROOT_DIR}") @@ -21,7 +19,13 @@ link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}") include(${MACRO_DIR}/IncludeGLM.cmake) include_glm(${TARGET_NAME} "${ROOT_DIR}") -target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script) +find_package(Qt5Script) +find_package(Qt5Widgets) + +# set a property indicating the libraries we are dependent on and link them to ourselves +set(DEPENDENCY_LIBRARIES Qt5::Script Qt5::Widgets) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}") +target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES}) # add a definition for ssize_t so that windows doesn't bail if (WIN32) diff --git a/libraries/models/CMakeLists.txt b/libraries/models/CMakeLists.txt index 8056d215da..142faee2b3 100644 --- a/libraries/models/CMakeLists.txt +++ b/libraries/models/CMakeLists.txt @@ -8,11 +8,8 @@ set(TARGET_NAME models) find_package(Qt5Widgets REQUIRED) -include(${MACRO_DIR}/AutoMTC.cmake) -auto_mtc(${TARGET_NAME} "${ROOT_DIR}") - include(${MACRO_DIR}/SetupHifiLibrary.cmake) -setup_hifi_library(${TARGET_NAME} "${AUTOMTC_SRC}") +setup_hifi_library(${TARGET_NAME}) include(${MACRO_DIR}/IncludeGLM.cmake) include_glm(${TARGET_NAME} "${ROOT_DIR}") @@ -27,12 +24,6 @@ link_hifi_library(animation ${TARGET_NAME} "${ROOT_DIR}") # for streamable link_hifi_library(metavoxels ${TARGET_NAME} "${ROOT_DIR}") -# link ZLIB -find_package(ZLIB) - -include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}" Qt5::Widgets) - # add a definition for ssize_t so that windows doesn't bail if (WIN32) add_definitions(-Dssize_t=long) diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index 215d406133..2d47f7df9b 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -2,21 +2,16 @@ set(ROOT_DIR ../..) set(MACRO_DIR "${ROOT_DIR}/cmake/macros") set(TARGET_NAME networking) -project(${TARGET_NAME}) include(${MACRO_DIR}/SetupHifiLibrary.cmake) setup_hifi_library(${TARGET_NAME}) -# include GLM -include(${MACRO_DIR}/IncludeGLM.cmake) -include_glm(${TARGET_NAME} "${ROOT_DIR}") - find_package(Qt5Network) -# bubble up the libraries we are dependent on and link them to ourselves -set(REQUIRED_DEPENDENCY_LIBRARIES Qt5::Network) -set(SUB_DEPENDENCY_LIBRARIES ${REQUIRED_DEPENDENCY_LIBRARIES} PARENT_SCOPE) -target_link_libraries(${TARGET_NAME} ${REQUIRED_DEPENDENCY_LIBRARIES}) +# set a property indicating the libraries we are dependent on and link them to ourselves +set(DEPENDENCY_LIBRARIES Qt5::Network) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${DEPENDENCY_LIBRARIES}") +target_link_libraries(${TARGET_NAME} ${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 067551ba31..5faedff6ed 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -14,16 +14,16 @@ include_glm(${TARGET_NAME} "${ROOT_DIR}") # link required libraries on UNIX if (APPLE) find_library(CoreServices CoreServices) - list(APPEND REQUIRED_DEPENDENCY_LIBRARIES ${CoreServices}) + set(DEPENDENCY_LIBRARIES ${CoreServices}) elseif (UNIX) find_package(Threads REQUIRED) - LIST(APPEND REQUIRED_DEPENDENCY_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + set(DEPENDENCY_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") endif () find_package(Qt5Network) find_package(Qt5Widgets) # bubble up the libraries we are dependent on and link them to ourselves -list(APPEND 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 +list(APPEND DEPENDENCY_LIBRARIES Qt5::Network Qt5::Widgets) +set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES ${DEPENDENCY_LIBRARIES}) +target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES}) \ No newline at end of file