diff --git a/CMakeLists.txt b/CMakeLists.txt index 9538784..04bb826 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(BUILD_INSERTPROXY "Enables or disables the build of Insert Proxy Model" O option(BUILD_ROOTINDEXPROXY "Enables or disables the build of Root Index Proxy Model" ON) option(BUILD_GENERICMODEL "Enables or disables the build of Generic Model" ON) option(OPTIMISE_FOR_MANY_ROLES "Set this property to ON if you plan to store more than 20 different roles in the models to optimise performance" OFF) +option(MODEL_UTILITIES_INSTALL "Generate installation target" ON) include(CTest) include(GetGitRevisionDescription) @@ -57,13 +58,15 @@ if(BUILD_TESTING) endif() add_subdirectory(tests) endif() -install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION licenses ) -SET(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/VSRonin/QtModelUtilities") -SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) -SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) -SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") -SET(CPACK_PACKAGE_FILE_NAME "QtModelUtilities-${VERSION_SHORT}-${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-Qt${QT_VERSION_MAJOR}-${modelutilities_PlatformDir}") -include(CPack) +if(MODEL_UTILITIES_INSTALL) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION licenses) + SET(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/VSRonin/QtModelUtilities") + SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) + SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) + SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) + SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + SET(CPACK_PACKAGE_FILE_NAME "QtModelUtilities-${VERSION_SHORT}-${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-Qt${QT_VERSION_MAJOR}-${modelutilities_PlatformDir}") + include(CPack) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 38bbf71..805c2a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,8 +115,10 @@ if(BUILD_DOCS) COMMENT "Generating API documentation with Doxygen" VERBATIM ) - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/html DESTINATION docs COMPONENT documentation) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/docs/htmldocs.html DESTINATION docs COMPONENT documentation) + if(MODEL_UTILITIES_INSTALL) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/html DESTINATION docs COMPONENT documentation) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/docs/htmldocs.html DESTINATION docs COMPONENT documentation) + endif() endif() if(modelutilities_SRCS) set(modelutilities_SRCS ${modelutilities_SRCS} private/modelutilities_common_p.h) @@ -164,48 +166,50 @@ if(modelutilities_SRCS) LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${modelutilities_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${modelutilities_PlatformDir}/bin" ) - install(FILES ${modelutilities_INSTALL_INCLUDE} "${CMAKE_CURRENT_BINARY_DIR}/globaldefs/modelutilities_global.h" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT QtModelUtilities_Development - ) - install(TARGETS QtModelUtilities - EXPORT QtModelUtilitiesTargets - RUNTIME - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT QtModelUtilities_Runtime - LIBRARY - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT QtModelUtilities_Runtime - NAMELINK_SKIP - INCLUDES + if(MODEL_UTILITIES_INSTALL) + install(FILES ${modelutilities_INSTALL_INCLUDE} "${CMAKE_CURRENT_BINARY_DIR}/globaldefs/modelutilities_global.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT QtModelUtilities_Development - ARCHIVE - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT QtModelUtilities_Development - ) - if(BUILD_SHARED_LIBS) + ) install(TARGETS QtModelUtilities EXPORT QtModelUtilitiesTargets + RUNTIME + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT QtModelUtilities_Runtime LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT QtModelUtilities_Runtime + NAMELINK_SKIP + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT QtModelUtilities_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT QtModelUtilities_Development - NAMELINK_ONLY ) - endif() - include(CMakePackageConfigHelpers) - write_basic_package_version_file("QtModelUtilitiesConfigVersion.cmake" - VERSION ${VERSION_SHORT} - COMPATIBILITY SameMajorVersion - ) - install(EXPORT QtModelUtilitiesTargets - FILE QtModelUtilitiesTargets.cmake - NAMESPACE QtModelUtilities:: + if(BUILD_SHARED_LIBS) + install(TARGETS QtModelUtilities + EXPORT QtModelUtilitiesTargets + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT QtModelUtilities_Development + NAMELINK_ONLY + ) + endif() + include(CMakePackageConfigHelpers) + write_basic_package_version_file("QtModelUtilitiesConfigVersion.cmake" + VERSION ${VERSION_SHORT} + COMPATIBILITY SameMajorVersion + ) + install(EXPORT QtModelUtilitiesTargets + FILE QtModelUtilitiesTargets.cmake + NAMESPACE QtModelUtilities:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtModelUtilities + COMPONENT QtModelUtilities_Development + ) + install(FILES "QtModelUtilitiesConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/QtModelUtilitiesConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtModelUtilities COMPONENT QtModelUtilities_Development - ) - install(FILES "QtModelUtilitiesConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/QtModelUtilitiesConfigVersion.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtModelUtilities - COMPONENT QtModelUtilities_Development - ) + ) + endif() endif()