mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 18:07:59 +08:00
cmake: always install the pkg-config file (#193)
There's really never a reason to *not* want this installed. If an option is needed to specify installing in a versioned subdirectory, this option should be explicitly described rather than hidden in something else. As an added bonus, this makes the CMake install code slightly *less* complicated.
This commit is contained in:
parent
341cea5a32
commit
daeb8013b2
@ -4,7 +4,7 @@ project(pugixml)
|
|||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||||
option(BUILD_TESTS "Build tests" OFF)
|
option(BUILD_TESTS "Build tests" OFF)
|
||||||
option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" OFF)
|
option(USE_VERSIONED_LIBDIR "Use a private subdirectory to install the headers and libs" OFF)
|
||||||
|
|
||||||
set(BUILD_DEFINES "" CACHE STRING "Build defines")
|
set(BUILD_DEFINES "" CACHE STRING "Build defines")
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ endif()
|
|||||||
set_target_properties(pugixml PROPERTIES VERSION 1.9 SOVERSION 1)
|
set_target_properties(pugixml PROPERTIES VERSION 1.9 SOVERSION 1)
|
||||||
get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
|
get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
|
||||||
|
|
||||||
if(BUILD_PKGCONFIG)
|
if(USE_VERSIONED_LIBDIR)
|
||||||
# Install library into its own directory under LIBDIR
|
# Install library into its own directory under LIBDIR
|
||||||
set(INSTALL_SUFFIX /pugixml-${PUGIXML_VERSION_STRING})
|
set(INSTALL_SUFFIX /pugixml-${PUGIXML_VERSION_STRING})
|
||||||
endif()
|
endif()
|
||||||
@ -71,10 +71,8 @@ install(TARGETS pugixml EXPORT pugixml-config
|
|||||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
|
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
|
||||||
install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
|
install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
|
||||||
|
|
||||||
if(BUILD_PKGCONFIG)
|
configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
|
||||||
configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
|
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
|
||||||
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(BUILD_TESTS)
|
if(BUILD_TESTS)
|
||||||
file(GLOB TEST_SOURCES tests/*.cpp)
|
file(GLOB TEST_SOURCES tests/*.cpp)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
includedir=${prefix}/include/pugixml-@PUGIXML_VERSION_STRING@
|
includedir=${prefix}/include@INSTALL_SUFFIX@
|
||||||
libdir=${exec_prefix}/lib/pugixml-@PUGIXML_VERSION_STRING@
|
libdir=${exec_prefix}/lib@INSTALL_SUFFIX@
|
||||||
|
|
||||||
Name: pugixml
|
Name: pugixml
|
||||||
Description: Light-weight, simple and fast XML parser for C++ with XPath support.
|
Description: Light-weight, simple and fast XML parser for C++ with XPath support.
|
||||||
URL: http://pugixml.org/
|
URL: http://pugixml.org/
|
||||||
Version: @PUGIXML_VERSION_STRING@
|
Version: @PUGIXML_VERSION_STRING@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
Libs: -L${libdir} -lpugixml
|
Libs: -L${libdir} -lpugixml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user