0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 21:04:25 +08:00

Merge pull request #585 from ilya-lavrenov/install-rules

Added cmake option to disable install rules
This commit is contained in:
Arseny Kapoulkine 2023-10-13 20:14:59 -07:00 committed by GitHub
commit 2e357d19a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,7 @@ cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
# Expose options from the pugiconfig.hpp # Expose options from the pugiconfig.hpp
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF) option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
option(PUGIXML_COMPACT "Enable compact mode" OFF) option(PUGIXML_COMPACT "Enable compact mode" OFF)
option(PUGIXML_INSTALL "Enable installation rules" ON)
# Advanced options from pugiconfig.hpp # Advanced options from pugiconfig.hpp
option(PUGIXML_NO_XPATH "Disable XPath" OFF) option(PUGIXML_NO_XPATH "Disable XPath" OFF)
@ -193,50 +194,53 @@ endif()
configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY) configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY)
if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT) export(TARGETS ${install-targets}
set(PUGIXML_RUNTIME_COMPONENT Runtime)
endif()
if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
set(PUGIXML_LIBRARY_COMPONENT Library)
endif()
if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
set(PUGIXML_DEVELOPMENT_COMPONENT Development)
endif()
set(namelink-component)
if (NOT CMAKE_VERSION VERSION_LESS 3.12)
set(namelink-component NAMELINK_COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
endif()
install(TARGETS ${install-targets}
EXPORT pugixml-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PUGIXML_RUNTIME_COMPONENT}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_LIBRARY_COMPONENT} ${namelink-component}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir})
install(EXPORT pugixml-targets
NAMESPACE pugixml:: NAMESPACE pugixml::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}) FILE pugixml-targets.cmake)
export(EXPORT pugixml-targets if(PUGIXML_INSTALL)
NAMESPACE pugixml::) if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT)
set(PUGIXML_RUNTIME_COMPONENT Runtime)
endif()
install(FILES if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake" set(PUGIXML_LIBRARY_COMPONENT Library)
"${PROJECT_BINARY_DIR}/pugixml-config.cmake" endif()
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}) set(PUGIXML_DEVELOPMENT_COMPONENT Development)
endif()
install( set(namelink-component)
FILES if (NOT CMAKE_VERSION VERSION_LESS 3.12)
"${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp" set(namelink-component NAMELINK_COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
"${PROJECT_SOURCE_DIR}/src/pugixml.hpp" endif()
DESTINATION install(TARGETS ${install-targets}
${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}) EXPORT pugixml-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PUGIXML_RUNTIME_COMPONENT}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_LIBRARY_COMPONENT} ${namelink-component}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir})
install(EXPORT pugixml-targets
NAMESPACE pugixml::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
install(FILES
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
"${PROJECT_BINARY_DIR}/pugixml-config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
install(
FILES
"${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp"
"${PROJECT_SOURCE_DIR}/src/pugixml.hpp"
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
endif()
if (PUGIXML_BUILD_TESTS) if (PUGIXML_BUILD_TESTS)
include(CTest) include(CTest)