diff --git a/cmake/tomlplusplus.cmake.in b/cmake/tomlplusplus.cmake.in new file mode 100644 index 0000000..4a836da --- /dev/null +++ b/cmake/tomlplusplus.cmake.in @@ -0,0 +1,14 @@ +@PACKAGE_INIT@ + +# If tomlplusplus::tomlplusplus target is not defined it will be included +if(NOT TARGET tomlplusplus::tomlplusplus) + + # Import tomlplusplus interface library + add_library(tomlplusplus::tomlplusplus INTERFACE IMPORTED) + set_target_properties(tomlplusplus::tomlplusplus PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/include") + + # Require C++17 + target_compile_features(tomlplusplus::tomlplusplus INTERFACE cxx_std_17) + +endif() diff --git a/meson.build b/meson.build index 669a1ca..405f2ab 100644 --- a/meson.build +++ b/meson.build @@ -17,6 +17,7 @@ tomlplusplus_dep = declare_dependency( version : meson.project_version(), ) + build_tests = false if get_option('BUILD_TESTS').auto() build_tests = (not meson.is_subproject()) @@ -109,3 +110,15 @@ pkgc.generate ( version: meson.project_version(), description: 'Header-only TOML config file parser and serializer for modern C++' ) + +cmake = import('cmake') +cmake.write_basic_package_version_file( + name: 'tomlplusplus', + version: meson.project_version()) + +conf = configuration_data() +cmake.configure_package_config_file( + name: 'tomlplusplus', + input: 'cmake/tomlplusplus.cmake.in', + configuration: conf, +)