From 45e3e703b1f55f3e3e3a965ad60cc3c65f912ac8 Mon Sep 17 00:00:00 2001 From: leha-bot Date: Sun, 8 Oct 2023 19:47:12 +0300 Subject: [PATCH] Fix CMake install() for proper find_package()/add_subdirectory() support --- CMakeLists.txt | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa73fab..3f215e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,25 +20,35 @@ add_library(QtAwesome QtAwesome/QtAwesomeFree.qrc ) +include(GNUInstallDirs) + target_include_directories(QtAwesome - INTERFACE ${PROJECT_SOURCE_DIR}/QtAwesome + INTERFACE + $ + $ ) target_link_libraries(QtAwesome PUBLIC Qt${QT_VERSION_MAJOR}::Widgets ) -install(TARGETS QtAwesome - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +install(TARGETS QtAwesome EXPORT QtAwesomeConfig + RUNTIME DESTINATION ${CMAKE_INSTALL_BINARYDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +install(EXPORT QtAwesomeConfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtAwesome/ + NAMESPACE QtAwesome:: +) +export(EXPORT QtAwesomeConfig NAMESPACE QtAwesome::) + install(FILES QtAwesome/QtAwesome.h QtAwesome/QtAwesomeAnim.h QtAwesome/QtAwesomeEnumGenerated.h QtAwesome/QtAwesomeStringGenerated.h - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QtAwesome )