Hardcode many fewer things in the meson-generated cmake files
This commit is contained in:
parent
0ca7385016
commit
1e41177de6
@ -1,6 +1,8 @@
|
|||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
add_library(jsoncpp_lib IMPORTED SHARED)
|
@MESON_SHARED_TARGET@
|
||||||
set_target_properties(jsoncpp_lib PROPERTIES
|
@MESON_STATIC_TARGET@
|
||||||
IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/lib/libjsoncpp.so"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include")
|
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-namespaced-targets.cmake" )
|
||||||
|
|
||||||
|
check_required_components(JsonCpp)
|
||||||
|
32
meson.build
32
meson.build
@ -15,7 +15,7 @@ project(
|
|||||||
'cpp_std=c++11',
|
'cpp_std=c++11',
|
||||||
'warning_level=1'],
|
'warning_level=1'],
|
||||||
license : 'Public Domain',
|
license : 'Public Domain',
|
||||||
meson_version : '>= 0.49.0')
|
meson_version : '>= 0.54.0')
|
||||||
|
|
||||||
|
|
||||||
jsoncpp_headers = files([
|
jsoncpp_headers = files([
|
||||||
@ -63,11 +63,41 @@ import('pkgconfig').generate(
|
|||||||
description : 'A C++ library for interacting with JSON')
|
description : 'A C++ library for interacting with JSON')
|
||||||
|
|
||||||
cmakeconf = configuration_data()
|
cmakeconf = configuration_data()
|
||||||
|
cmakeconf.set('MESON_LIB_DIR', get_option('libdir'))
|
||||||
|
cmakeconf.set('MESON_INCLUDE_DIR', get_option('includedir'))
|
||||||
|
|
||||||
|
fs = import('fs')
|
||||||
|
if get_option('default_library') == 'shared'
|
||||||
|
shared_name = fs.name(jsoncpp_lib.full_path())
|
||||||
|
endif
|
||||||
|
if get_option('default_library') == 'static'
|
||||||
|
static_name = fs.name(jsoncpp_lib.full_path())
|
||||||
|
endif
|
||||||
|
if get_option('default_library') == 'both'
|
||||||
|
shared_name = fs.name(jsoncpp_lib.get_shared_lib().full_path())
|
||||||
|
static_name = fs.name(jsoncpp_lib.get_static_lib().full_path())
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('default_library') == 'shared' or get_option('default_library') == 'both'
|
||||||
|
cmakeconf.set('MESON_SHARED_TARGET', '''
|
||||||
|
add_library(jsoncpp_lib IMPORTED SHARED)
|
||||||
|
set_target_properties(jsoncpp_lib PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/''' + get_option('libdir') + '/' + shared_name + '''"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/''' + get_option('includedir') + '")')
|
||||||
|
endif
|
||||||
|
if get_option('default_library') == 'static' or get_option('default_library') == 'both'
|
||||||
|
cmakeconf.set('MESON_STATIC_TARGET', '''
|
||||||
|
add_library(jsoncpp_static IMPORTED STATIC)
|
||||||
|
set_target_properties(jsoncpp_static PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/''' + get_option('libdir') + '/' + static_name + '''"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/''' + get_option('includedir') + '")')
|
||||||
|
endif
|
||||||
|
|
||||||
import('cmake').configure_package_config_file(
|
import('cmake').configure_package_config_file(
|
||||||
name: 'jsoncpp',
|
name: 'jsoncpp',
|
||||||
input: 'jsoncppConfig.cmake.meson.in',
|
input: 'jsoncppConfig.cmake.meson.in',
|
||||||
configuration: cmakeconf)
|
configuration: cmakeconf)
|
||||||
|
install_data('jsoncpp-namespaced-targets.cmake', install_dir : get_option('libdir') + '/cmake/' + jsoncpp_lib.name())
|
||||||
|
|
||||||
# for libraries bundling jsoncpp
|
# for libraries bundling jsoncpp
|
||||||
jsoncpp_dep = declare_dependency(
|
jsoncpp_dep = declare_dependency(
|
||||||
|
Loading…
Reference in New Issue
Block a user