mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 21:33:48 +02:00
remove bubbling of linked libraries, cmake does it
This commit is contained in:
parent
b202eb7dae
commit
d38c78f2c3
10 changed files with 21 additions and 39 deletions
|
@ -12,7 +12,7 @@ link_hifi_libraries(
|
|||
)
|
||||
|
||||
if (UNIX)
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS})
|
||||
endif (UNIX)
|
||||
|
||||
link_shared_dependencies()
|
||||
|
|
|
@ -25,18 +25,9 @@ macro(LINK_HIFI_LIBRARIES)
|
|||
# link the actual library - it is static so don't bubble it up
|
||||
target_link_libraries(${TARGET_NAME} ${HIFI_LIBRARY})
|
||||
|
||||
# ask the library what its dynamic dependencies are and link them
|
||||
get_target_property(LINKED_TARGET_DEPENDENCY_LIBRARIES ${HIFI_LIBRARY} DEPENDENCY_LIBRARIES)
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK ${LINKED_TARGET_DEPENDENCY_LIBRARIES})
|
||||
|
||||
# ask the library what its include dependencies are and link them
|
||||
get_target_property(LINKED_TARGET_DEPENDENCY_INCLUDES ${HIFI_LIBRARY} DEPENDENCY_INCLUDES)
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES ${LINKED_TARGET_DEPENDENCY_INCLUDES})
|
||||
|
||||
# ask the library what its qt module dependencies are and link them
|
||||
get_target_property(LINKED_TARGET_DEPENDENCY_QT_MODULES ${HIFI_LIBRARY} DEPENDENCY_QT_MODULES)
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES ${LINKED_TARGET_DEPENDENCY_QT_MODULES})
|
||||
|
||||
endforeach()
|
||||
|
||||
endmacro(LINK_HIFI_LIBRARIES)
|
|
@ -9,14 +9,7 @@
|
|||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
|
||||
macro(LINK_SHARED_DEPENDENCIES)
|
||||
if (${TARGET_NAME}_LIBRARIES_TO_LINK)
|
||||
list(REMOVE_DUPLICATES ${TARGET_NAME}_LIBRARIES_TO_LINK)
|
||||
|
||||
# link these libraries to our target
|
||||
target_link_libraries(${TARGET_NAME} ${${TARGET_NAME}_LIBRARIES_TO_LINK})
|
||||
endif ()
|
||||
|
||||
macro(LINK_SHARED_DEPENDENCIES)
|
||||
if (${TARGET_NAME}_DEPENDENCY_INCLUDES)
|
||||
list(REMOVE_DUPLICATES ${TARGET_NAME}_DEPENDENCY_INCLUDES)
|
||||
|
||||
|
@ -24,22 +17,6 @@ macro(LINK_SHARED_DEPENDENCIES)
|
|||
include_directories(SYSTEM ${${TARGET_NAME}_DEPENDENCY_INCLUDES})
|
||||
endif ()
|
||||
|
||||
if (${TARGET_NAME}_DEPENDENCY_QT_MODULES)
|
||||
list(REMOVE_DUPLICATES ${TARGET_NAME}_DEPENDENCY_QT_MODULES)
|
||||
|
||||
# find these Qt modules and link them to our own target
|
||||
find_package(Qt5 COMPONENTS ${${TARGET_NAME}_DEPENDENCY_QT_MODULES} REQUIRED)
|
||||
|
||||
foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES})
|
||||
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
|
||||
endforeach()
|
||||
endif ()
|
||||
|
||||
# we've already linked our Qt modules, but we need to bubble them up to parents
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${${TARGET_NAME}_QT_MODULES_TO_LINK}")
|
||||
|
||||
# set the property on this target so it can be retreived by targets linking to us
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_LIBRARIES "${${TARGET_NAME}_LIBRARIES_TO_LINK}")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_INCLUDES "${${TARGET_NAME}_DEPENDENCY_INCLUDES}")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_QT_MODULES "${${TARGET_NAME}_DEPENDENCY_QT_MODULES}")
|
||||
endmacro(LINK_SHARED_DEPENDENCIES)
|
|
@ -21,4 +21,11 @@ macro(SETUP_HIFI_LIBRARY)
|
|||
set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN})
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core)
|
||||
|
||||
# find these Qt modules and link them to our own target
|
||||
find_package(Qt5 COMPONENTS ${${TARGET_NAME}_DEPENDENCY_QT_MODULES} REQUIRED)
|
||||
|
||||
foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES})
|
||||
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
|
||||
endforeach()
|
||||
|
||||
endmacro(SETUP_HIFI_LIBRARY)
|
|
@ -27,4 +27,11 @@ macro(SETUP_HIFI_PROJECT)
|
|||
|
||||
set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN})
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core)
|
||||
|
||||
# find these Qt modules and link them to our own target
|
||||
find_package(Qt5 COMPONENTS ${${TARGET_NAME}_DEPENDENCY_QT_MODULES} REQUIRED)
|
||||
|
||||
foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES})
|
||||
target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE})
|
||||
endforeach()
|
||||
endmacro()
|
|
@ -50,6 +50,6 @@ endif ()
|
|||
include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
|
||||
|
||||
# append OpenSSL to our list of libraries to link
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${OPENSSL_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${OPENSSL_LIBRARIES}")
|
||||
|
||||
link_shared_dependencies()
|
|
@ -9,7 +9,7 @@ link_hifi_libraries(shared networking octree voxels)
|
|||
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
# call macro to link our dependencies and bubble them up via a property on our target
|
||||
link_shared_dependencies()
|
||||
|
|
|
@ -23,7 +23,7 @@ endif ()
|
|||
include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
|
||||
|
||||
# append OpenSSL to our list of libraries to link
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${OPENSSL_LIBRARIES}" "${TBB_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${OPENSSL_LIBRARIES}" "${TBB_LIBRARIES}")
|
||||
|
||||
# append libcuckoo includes to our list of includes to bubble
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${TBB_INCLUDE_DIRS}")
|
||||
|
|
|
@ -13,7 +13,7 @@ find_package(ZLIB REQUIRED)
|
|||
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
|
||||
|
||||
# append ZLIB and OpenSSL to our list of libraries to link
|
||||
list(APPEND ${TARGET_NAME}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
# call macro to link our dependencies and bubble them up via a property on our target
|
||||
link_shared_dependencies()
|
||||
|
|
|
@ -12,7 +12,7 @@ find_package(ZLIB REQUIRED)
|
|||
include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
|
||||
|
||||
# add it to our list of libraries to link
|
||||
list(APPEND ${TARGET}_LIBRARIES_TO_LINK "${ZLIB_LIBRARIES}")
|
||||
target_link_libraries(${TARGET_NAME} "${ZLIB_LIBRARIES}")
|
||||
|
||||
# call macro to link our dependencies and bubble them up via a property on our target
|
||||
link_shared_dependencies()
|
Loading…
Reference in a new issue