From 909c189d7f71e801cfc2100de15ec4fa94874f46 Mon Sep 17 00:00:00 2001 From: Krzysztof Machura Date: Tue, 1 Oct 2019 10:25:24 +0200 Subject: [PATCH] Add support for CMake Find config module --- CMakeLists.txt | 26 +++++++++++++++++++++----- adsConfig.cmake | 5 +++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 adsConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a9f919..041721d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,11 +80,27 @@ install(FILES COMPONENT license ) install(TARGETS qtadvanceddocking - EXPORT adsBinary - RUNTIME DESTINATION bin COMPONENT library - LIBRARY DESTINATION lib COMPONENT library - ARCHIVE DESTINATION lib COMPONENT library + EXPORT adsTargets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include ) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("adsConfigVersion.cmake" + VERSION ${ads_VERSION} + COMPATIBILITY SameMajorVersion +) +install(EXPORT adsTargets + FILE adsTargets.cmake + NAMESPACE ads:: + DESTINATION lib/cmake/ads +) +install(FILES "adsConfig.cmake" "${CMAKE_BINARY_DIR}/adsConfigVersion.cmake" + DESTINATION lib/cmake/ads +) + target_include_directories(qtadvanceddocking PUBLIC "$" $ @@ -93,7 +109,7 @@ target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS}) target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE}) set_target_properties(qtadvanceddocking PROPERTIES VERSION ${ads_VERSION} - EXPORT_NAME "Qt Advanced Docking System" + EXPORT_NAME "QtAdvancedDockingSystem" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" diff --git a/adsConfig.cmake b/adsConfig.cmake new file mode 100644 index 0000000..542e5c9 --- /dev/null +++ b/adsConfig.cmake @@ -0,0 +1,5 @@ +include(CMakeFindDependencyMacro) +find_dependency(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) +find_dependency(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) +find_dependency(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake") \ No newline at end of file