mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 02:00:50 +08:00
Fix generation of pkg-config file with absolute includedir/libdir. (#1199)
This commit is contained in:
parent
bf0cfa5b46
commit
5be07bdc5e
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
# CMake-generated files:
|
# CMake-generated files:
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
*.cmake
|
|
||||||
/pkg-config/jsoncpp.pc
|
/pkg-config/jsoncpp.pc
|
||||||
jsoncpp_lib_static.dir/
|
jsoncpp_lib_static.dir/
|
||||||
|
|
||||||
|
@ -49,6 +49,8 @@ if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
|
|||||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# use ccache if found, has to be done before project()
|
# use ccache if found, has to be done before project()
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -148,6 +150,11 @@ if(JSONCPP_WITH_WARNING_AS_ERROR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||||
|
include(JoinPaths)
|
||||||
|
|
||||||
|
join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"pkg-config/jsoncpp.pc.in"
|
"pkg-config/jsoncpp.pc.in"
|
||||||
"pkg-config/jsoncpp.pc"
|
"pkg-config/jsoncpp.pc"
|
||||||
|
23
cmake/JoinPaths.cmake
Normal file
23
cmake/JoinPaths.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# This module provides a function for joining paths
|
||||||
|
# known from most languages
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (MIT OR CC0-1.0)
|
||||||
|
# Copyright 2020 Jan Tojnar
|
||||||
|
# https://github.com/jtojnar/cmake-snips
|
||||||
|
#
|
||||||
|
# Modelled after Python’s os.path.join
|
||||||
|
# https://docs.python.org/3.7/library/os.path.html#os.path.join
|
||||||
|
# Windows not supported
|
||||||
|
function(join_paths joined_path first_path_segment)
|
||||||
|
set(temp_path "${first_path_segment}")
|
||||||
|
foreach(current_segment IN LISTS ARGN)
|
||||||
|
if(NOT ("${current_segment}" STREQUAL ""))
|
||||||
|
if(IS_ABSOLUTE "${current_segment}")
|
||||||
|
set(temp_path "${current_segment}")
|
||||||
|
else()
|
||||||
|
set(temp_path "${temp_path}/${current_segment}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${joined_path} "${temp_path}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
@ -1,7 +1,7 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
libdir=@libdir_for_pc_file@
|
||||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
includedir=@includedir_for_pc_file@
|
||||||
|
|
||||||
Name: jsoncpp
|
Name: jsoncpp
|
||||||
Description: A C++ library for interacting with JSON
|
Description: A C++ library for interacting with JSON
|
||||||
|
Loading…
x
Reference in New Issue
Block a user