Skip to content

Commit d333f08

Browse files
authored
CMake: generate a pkg-config file that follow pkg-config conventions (nlohmann#4456)
* CMake: configure pkg-config with @only And use @ replacement instead of {}, since ${} is significant in pkg-config's format * CMake: use conventional prefix and incluedir variables in pkg-config This is more standard, and has some advantages when cross compiling. This also means that the pkg-config files generated by Meson and CMake now match.
1 parent 3d6c664 commit d333f08

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ endif()
149149
CONFIGURE_FILE(
150150
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkg-config.pc.in"
151151
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
152+
@ONLY
152153
)
153154

154155
##

cmake/pkg-config.pc.in

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
Name: ${PROJECT_NAME}
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
3+
4+
Name: @PROJECT_NAME@
25
Description: JSON for Modern C++
3-
Version: ${PROJECT_VERSION}
4-
Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR}
6+
Version: @PROJECT_VERSION@
7+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)