diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-09-20 22:11:42 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-09-20 22:11:42 -0700 |
commit | fd896d2476e087090196287cba64843db87533e5 (patch) | |
tree | a88d3c3b479c6267bfbad842118f9299a93eb825 | |
parent | 0918dd2b9925995577b5578404a86a6c017b4740 (diff) |
CMake: Simplify pkg-config support
Merge USEOWNSUBDIR and PKGCONFIG build flags; move the pkg-config source file
to scripts/.
-rw-r--r-- | CMakeLists.txt | 32 | ||||
-rw-r--r-- | scripts/pugixml.pc.in (renamed from misc/cmake/pugixml.pc) | 4 |
2 files changed, 7 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 270b875..a843989 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 2.6) option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF) option(BUILD_TESTS "Build tests" OFF) -option(BUILD_PKGCONFIG "Build PKGCONFIG file" OFF) -option(BUILD_USEOWNSUBDIR "Use a separate directory to install include and lib files" OFF) +option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" OFF) set(BUILD_DEFINES "" CACHE STRING "Build defines") @@ -51,18 +50,7 @@ endif() set_target_properties(pugixml PROPERTIES VERSION 1.7 SOVERSION 1) get_target_property(PUGIXML_VERSION_STRING pugixml VERSION) -set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") -if(BUILD_USEOWNSUBDIR) - set(INSTALL_LIB_DIR "lib/pugixml-${PUGIXML_VERSION_STRING}" CACHE PATH "Installation directory for libraries") - set(INSTALL_INCLUDE_DIR "include/pugixml-${PUGIXML_VERSION_STRING}" CACHE PATH "Installation directory for header files") -else() - set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") - set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Installation directory for header files") -endif() - -set(INSTALL_PKGCONFIG_DIR "lib/pkgconfig" CACHE PATH "Installation directory for pkg-config file") - -if(BUILD_USEOWNSUBDIR) +if(BUILD_PKGCONFIG) # Install shared library into its own directory under LIBDIR install(TARGETS pugixml EXPORT pugixml-config ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/pugixml-${PUGIXML_VERSION_STRING} @@ -86,19 +74,9 @@ endif() install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml) -if(BUILD_SHARED_LIBS AND BUILD_PKGCONFIG) - ############################################################################### - # prepare pkg-config file - configure_file(misc/cmake/pugixml.pc - "${PROJECT_BINARY_DIR}/pugixml.pc" @ONLY) - - # copy the pugixml.pc file into lib/pkgconfig - if(INSTALL_PKGCONFIG_DIR) - install( - FILES ${PROJECT_BINARY_DIR}/pugixml.pc - DESTINATION ${INSTALL_PKGCONFIG_DIR}) - endif() - ############################################################################### +if(BUILD_PKGCONFIG) + 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) endif() if(BUILD_TESTS) diff --git a/misc/cmake/pugixml.pc b/scripts/pugixml.pc.in index 283c9a7..3c97c28 100644 --- a/misc/cmake/pugixml.pc +++ b/scripts/pugixml.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -includedir=${prefix}/@INSTALL_INCLUDE_DIR@ -libdir=${exec_prefix}/@INSTALL_LIB_DIR@ +includedir=${prefix}/include/pugixml-@PUGIXML_VERSION_STRING@ +libdir=${exec_prefix}/lib/pugixml-@PUGIXML_VERSION_STRING@ Name: pugixml Description: Light-weight, simple and fast XML parser for C++ with XPath support. |