cmake: Generate and install a pkg-config file.
The meson builds install a pkg-config file, but the cmake builds don't. This adds a pkg-config file to the cmake builds that is functionally equivalent to the one generated from meson.
This commit is contained in:
parent
d019ddfcdb
commit
c7d18c1625
2 changed files with 15 additions and 1 deletions
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
|
|||
## PROJECT
|
||||
## name and version
|
||||
##
|
||||
project(nlohmann_json VERSION 3.8.0 LANGUAGES CXX)
|
||||
project(nlohmann_json VERSION 3.8.0 DESCRIPTION "JSON for Modern C++" LANGUAGES CXX)
|
||||
|
||||
##
|
||||
## INCLUDE
|
||||
|
@ -79,6 +79,12 @@ if (MSVC)
|
|||
)
|
||||
endif()
|
||||
|
||||
# Install a pkg-config file, so other tools can find this.
|
||||
CONFIGURE_FILE(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkg-config.pc.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||
)
|
||||
|
||||
##
|
||||
## TESTS
|
||||
## create and configure the unit test target
|
||||
|
@ -139,4 +145,8 @@ endif()
|
|||
NAMESPACE ${PROJECT_NAME}::
|
||||
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||
DESTINATION lib/pkgconfig
|
||||
)
|
||||
endif()
|
||||
|
|
4
cmake/pkg-config.pc.in
Normal file
4
cmake/pkg-config.pc.in
Normal file
|
@ -0,0 +1,4 @@
|
|||
Name: ${PROJECT_NAME}
|
||||
Description: ${PROJECT_DESCRIPTION}
|
||||
Version: ${PROJECT_VERSION}
|
||||
Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}
|
Loading…
Reference in a new issue