Use find_dependency to find the dependencies

This commit is contained in:
Hannah von Reth 2016-08-05 11:00:55 +02:00 committed by Hannah von Reth
parent a3f7e52606
commit 0eaf3ad1a3
2 changed files with 23 additions and 6 deletions

View File

@ -114,10 +114,10 @@ endif()
if(APPLE)
list(APPEND qtkeychain_SOURCES keychain_mac.cpp)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
list(APPEND qtkeychain_LIBRARIES ${COREFOUNDATION_LIBRARY})
find_library(SECURITY_LIBRARY Security)
find_library(SECURITY_LIBRARY Security REQUIRED)
list(APPEND qtkeychain_LIBRARIES ${SECURITY_LIBRARY})
endif()
@ -192,7 +192,7 @@ install(TARGETS ${QTKEYCHAIN_TARGET_NAME}
)
add_executable( testclient testclient.cpp )
target_link_libraries( testclient ${QTKEYCHAIN_TARGET_NAME} ${qtkeychain_LIBRARIES})
target_link_libraries( testclient ${QTKEYCHAIN_TARGET_NAME})
###

View File

@ -6,10 +6,27 @@
# Compute paths
get_filename_component(QTKEYCHAIN_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${QTKEYCHAIN_CMAKE_DIR}/CMakeCache.txt")
# In build tree
include("${QTKEYCHAIN_CMAKE_DIR}/Qt@QTKEYCHAIN_VERSION_INFIX@KeychainBuildTreeSettings.cmake")
# In build tree
include("${QTKEYCHAIN_CMAKE_DIR}/Qt@QTKEYCHAIN_VERSION_INFIX@KeychainBuildTreeSettings.cmake")
else()
set(QTKEYCHAIN_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(QTKEYCHAIN_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
endif()
include(CMakeFindDependencyMacro)
if("@QTKEYCHAIN_VERSION_INFIX@" STREQUAL "5")
find_dependency(Qt5Core)
if(UNIX AND NOT APPLE)
find_dependency(Qt5DBus)
endif()
else()
find_dependency(Qt4 COMPONENTS QtCore)
endif()
if(APPLE)
find_dependency(COREFOUNDATION_LIBRARY CoreFoundation)
find_dependency(SECURITY_LIBRARY Security)
endif()
# Our library dependencies (contains definitions for IMPORTED targets)