Skip to content

Commit

Permalink
Build: Include the headers in the library
Browse files Browse the repository at this point in the history
  • Loading branch information
Treata11 committed Jan 11, 2025
1 parent 4281999 commit acef692
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ cmake_dependent_option(PUGIXML_BUILD_TESTS
set(PUGIXML_BUILD_DEFINES CACHE STRING "Build defines for custom options")
separate_arguments(PUGIXML_BUILD_DEFINES)

# Public headers
set(PUGIXML_HEADERS
${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp
${PROJECT_SOURCE_DIR}/src/pugixml.hpp
)

# Technically not needed for this file. This is builtin CMAKE global variable.
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)

Expand Down Expand Up @@ -135,7 +141,8 @@ endif()

if (NOT BUILD_SHARED_LIBS OR PUGIXML_BUILD_SHARED_AND_STATIC_LIBS)
add_library(pugixml-static STATIC
${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
${PROJECT_SOURCE_DIR}/src/pugixml.cpp
${PUGIXML_HEADERS})
add_library(pugixml::static ALIAS pugixml-static)
list(APPEND libs pugixml-static)

Expand Down Expand Up @@ -182,8 +189,10 @@ if (PUGIXML_BUILD_APPLE_FRAMEWORK)
set_target_properties(${libs} PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${PROJECT_VERSION}
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.zeux.pugixml
MACOSX_FRAMEWORK_IDENTIFIER com.zeux.pugixml
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "github.com/zeux/pugixml"
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER "${PUGIXML_HEADERS}"
MACOSX_FRAMEWORK_IDENTIFIER "github.com/zeux/pugixml"
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR})
endif()
Expand Down Expand Up @@ -263,12 +272,8 @@ if(PUGIXML_INSTALL)
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})
install(FILES ${PUGIXML_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
endif()

if (PUGIXML_BUILD_TESTS)
Expand Down

0 comments on commit acef692

Please sign in to comment.