From 10903d7b9103f35bf9574c90baafdca0ad6e06be Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Sun, 18 Jul 2021 17:50:00 -0300 Subject: [PATCH] Fix instalation of include and libraries files --- CMakeLists.txt | 19 +++--- cmake/modules/CuteleeConfig.cmake.in | 8 +-- templates/lib/CMakeLists.txt | 90 ++++++++++++++-------------- textdocument/lib/CMakeLists.txt | 43 +++++++------ 4 files changed, 79 insertions(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d191768..915c3c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,37 +99,38 @@ if (BUILD_TEXTDOCUMENT) add_subdirectory(textdocument) endif() -set(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/Cutelee${Cutelee_VERSION_MAJOR}" ) +set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}" ) configure_file( "${Cutelee_MODULE_DIR}/CuteleeConfig.cmake.in" - "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Config.cmake" + "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}Config.cmake" @ONLY ) include(CMakePackageConfigHelpers) -write_basic_package_version_file("${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}ConfigVersion.cmake" +write_basic_package_version_file("${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}ConfigVersion.cmake" VERSION ${Cutelee_VERSION} COMPATIBILITY AnyNewerVersion ) install(FILES - "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Config.cmake" - "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}ConfigVersion.cmake" + "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}Config.cmake" + "${CMAKE_BINARY_DIR}/Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}ConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Common ) install(FILES "${Cutelee_MODULE_DIR}/CuteleeMacros.cmake" - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + RENAME "Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}Macros.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}/" COMPONENT Common ) install(EXPORT cutelee_targets - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" - NAMESPACE Cutelee${Cutelee_VERSION_MAJOR}:: - FILE CuteleeTargets.cmake + DESTINATION ${CMAKECONFIG_INSTALL_DIR} + FILE "Cutelee${Cutelee_VERSION_MAJOR}Qt${QT_VERSION_MAJOR}Targets.cmake" + NAMESPACE Cutelee:: COMPONENT Common ) diff --git a/cmake/modules/CuteleeConfig.cmake.in b/cmake/modules/CuteleeConfig.cmake.in index 14fa0b6..05e9c96 100644 --- a/cmake/modules/CuteleeConfig.cmake.in +++ b/cmake/modules/CuteleeConfig.cmake.in @@ -11,11 +11,11 @@ if (Cutelee@Cutelee_VERSION_MAJOR@_FIND_COMPONENTS) set(RequiredQtComponents ${RequiredQtComponents} Core) endif() endforeach() - find_package(Qt5 REQUIRED ${RequiredQtComponents}) + find_package(Qt@QT_VERSION_MAJOR@ REQUIRED ${RequiredQtComponents}) else() - find_package(Qt5Gui REQUIRED) + find_package(Qt@QT_VERSION_MAJOR@Gui REQUIRED) endif() -include("${CMAKE_CURRENT_LIST_DIR}/CuteleeTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/Cutelee@Cutelee_VERSION_MAJOR@Qt@QT_VERSION_MAJOR@Targets.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/CuteleeMacros.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/Cutelee@Cutelee_VERSION_MAJOR@Qt@QT_VERSION_MAJOR@Macros.cmake") diff --git a/templates/lib/CMakeLists.txt b/templates/lib/CMakeLists.txt index 8cbac6e..4f86956 100644 --- a/templates/lib/CMakeLists.txt +++ b/templates/lib/CMakeLists.txt @@ -11,6 +11,33 @@ set_source_files_properties(taglibraryinterface.h PROPERTIES SKIP_AUTOMOC TRUE ) +set(cutelee_templates_HEADERS + cutelee_templates.h + abstractlocalizer.h + cachingloaderdecorator.h + context.h + engine.h + exception.h + filter.h + filterexpression.h + ${CMAKE_CURRENT_BINARY_DIR}/cutelee_templates_export.h + ${CMAKE_CURRENT_BINARY_DIR}/cutelee_version.h + metatype.h + node.h + outputstream.h + parser.h + qtlocalizer.h + rendercontext.h + safestring.h + taglibraryinterface.h + template.h + templateloader.h + typeaccessor.h + token.h + util.h + variable.h +) + add_library(Cutelee_Templates SHARED abstractlocalizer.cpp cachingloaderdecorator.cpp @@ -36,24 +63,21 @@ add_library(Cutelee_Templates SHARED util.cpp variable.cpp - # Help IDEs find some non-compiled files. - customtyperegistry_p.h - engine_p.h - exception.h - cutelee_tags_p.h - cutelee_templates.h - lexer_p.h - metaenumvariable_p.h nodebuiltins_p.h nulllocalizer_p.h pluginpointer_p.h statemachine_p.h - taglibraryinterface.h template_p.h textprocessingmachine_p.h - token.h - typeaccessor.h + customtyperegistry_p.h + engine_p.h + cutelee_tags_p.h + lexer_p.h + metaenumvariable_p.h + + ${cutelee_templates_HEADERS} ) + add_library(Cutelee::Templates ALIAS Cutelee_Templates) generate_export_header(Cutelee_Templates) set_property(TARGET Cutelee_Templates PROPERTY @@ -123,41 +147,15 @@ set_target_properties(Cutelee_Templates PROPERTIES SOVERSION ${Cutelee_VERSION_MAJOR} ) -install(TARGETS Cutelee_Templates EXPORT cutelee_targets - RUNTIME DESTINATION bin COMPONENT Templates - LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT Templates - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Templates - INCLUDES DESTINATION include -) - -install(FILES - abstractlocalizer.h - cachingloaderdecorator.h - context.h - engine.h - exception.h - filter.h - filterexpression.h - ${CMAKE_CURRENT_BINARY_DIR}/cutelee_templates_export.h - ${CMAKE_CURRENT_BINARY_DIR}/cutelee_version.h - metatype.h - node.h - outputstream.h - parser.h - qtlocalizer.h - rendercontext.h - safestring.h - taglibraryinterface.h - template.h - templateloader.h - typeaccessor.h - token.h - util.h - variable.h - DESTINATION include/cutelee COMPONENT Templates +target_include_directories(Cutelee_Templates PUBLIC + $ + $ ) -install(FILES - cutelee_templates.h - DESTINATION include COMPONENT Templates +set_property(TARGET Cutelee_Templates PROPERTY PUBLIC_HEADER ${cutelee_templates_HEADERS}) +install(TARGETS Cutelee_Templates EXPORT cutelee_targets + RUNTIME DESTINATION bin COMPONENT Templates + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Templates + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Templates + PUBLIC_HEADER DESTINATION include/cutelee${PROJECT_VERSION_MAJOR}-qt${QT_VERSION_MAJOR}/cutelee ) diff --git a/textdocument/lib/CMakeLists.txt b/textdocument/lib/CMakeLists.txt index b295f27..b6a537a 100644 --- a/textdocument/lib/CMakeLists.txt +++ b/textdocument/lib/CMakeLists.txt @@ -1,3 +1,13 @@ +set(cutelee_textdocument_HEADERS + cutelee_textdocument.h + abstractmarkupbuilder.h + bbcodebuilder.h + markupdirector.h + plaintextmarkupbuilder.h + texthtmlbuilder.h + mediawikimarkupbuilder.h + ${CMAKE_CURRENT_BINARY_DIR}/cutelee_textdocument_export.h +) add_library(Cutelee_TextDocument SHARED bbcodebuilder.cpp @@ -6,11 +16,10 @@ add_library(Cutelee_TextDocument SHARED texthtmlbuilder.cpp mediawikimarkupbuilder.cpp - # Help IDEs find some non-compiled files. - abstractmarkupbuilder.h - cutelee_textdocument.h markupdirector_p.h + ${cutelee_textdocument_HEADERS} ) + generate_export_header(Cutelee_TextDocument) add_library(Cutelee::TextDocument ALIAS Cutelee_TextDocument) set_property(TARGET Cutelee_TextDocument PROPERTY @@ -44,25 +53,15 @@ set_target_properties(Cutelee_TextDocument PROPERTIES SOVERSION ${Cutelee_VERSION_MAJOR} ) -install(TARGETS Cutelee_TextDocument EXPORT cutelee_targets - RUNTIME DESTINATION bin COMPONENT TextDocument - LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT TextDocument - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT TextDocument - INCLUDES DESTINATION include -) - -install(FILES - abstractmarkupbuilder.h - bbcodebuilder.h - markupdirector.h - plaintextmarkupbuilder.h - texthtmlbuilder.h - mediawikimarkupbuilder.h - ${CMAKE_CURRENT_BINARY_DIR}/cutelee_textdocument_export.h - DESTINATION include/cutelee COMPONENT TextDocument +target_include_directories(Cutelee_TextDocument PUBLIC + $ + $ ) -install(FILES - cutelee_textdocument.h - DESTINATION include COMPONENT TextDocument +set_property(TARGET Cutelee_TextDocument PROPERTY PUBLIC_HEADER ${cutelee_textdocument_HEADERS}) +install(TARGETS Cutelee_TextDocument EXPORT cutelee_targets + RUNTIME DESTINATION bin COMPONENT TextDocument + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT TextDocument + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT TextDocument + PUBLIC_HEADER DESTINATION include/cutelee${PROJECT_VERSION_MAJOR}-qt${QT_VERSION_MAJOR}/cutelee )