cmake: Generate and install a pkg-config file
I'm trying to build mtxclient, which expects a nlohmann_json pkg-config file to exist in the system. 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. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
This commit is contained in:
parent
a015b78e81
commit
b8b189dcb2
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
## PROJECT
|
## PROJECT
|
||||||
## name and version
|
## name and version
|
||||||
##
|
##
|
||||||
project(nlohmann_json VERSION 3.7.0 LANGUAGES CXX)
|
project(nlohmann_json VERSION 3.7.0 DESCRIPTION "JSON for Modern C++" LANGUAGES CXX)
|
||||||
|
|
||||||
##
|
##
|
||||||
## INCLUDE
|
## INCLUDE
|
||||||
@ -73,6 +73,12 @@ if (MSVC)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Install a pkg-config file, so other tools can find this.
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
|
)
|
||||||
|
|
||||||
##
|
##
|
||||||
## TESTS
|
## TESTS
|
||||||
## create and configure the unit test target
|
## create and configure the unit test target
|
||||||
@ -128,4 +134,8 @@ if(JSON_Install)
|
|||||||
NAMESPACE ${PROJECT_NAME}::
|
NAMESPACE ${PROJECT_NAME}::
|
||||||
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
|
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
|
DESTINATION lib/pkgconfig
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
4
pkg-config.pc.cmake
Normal file
4
pkg-config.pc.cmake
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 New Issue
Block a user