Improve support for installing with cget (#88)

* Improve support for installing with cget

* add specific version, clean cmake

* fix version to "v2.1.0"
This commit is contained in:
Paul Fultz II
2019-02-16 05:39:59 -06:00
committed by pantor
parent 89652ca321
commit 4c0ee3a46c
4 changed files with 18 additions and 9 deletions

View File

@@ -7,8 +7,8 @@ project(inja LANGUAGES CXX VERSION 2.0.0)
option(INJA_USE_EMBEDDED_JSON "Use the shipped json header if not available on the system" ON)
option(INJA_INSTALL "Generate install targets for inja" ON)
option(INJA_EXPORT "Export the current build tree to the package registry" ON)
option(BUILD_TESTS "Build the inja unit tests" ON)
option(BUILD_BENCHMARK "Build the inja benchmark" ON)
option(BUILD_TESTING "Build unit tests" ON)
option(BUILD_BENCHMARK "Build benchmark" ON)
option(COVERALLS "Generate coveralls data" OFF)
set(INJA_INSTALL_INCLUDE_DIR "include")
@@ -82,7 +82,7 @@ if (COVERALLS)
endif()
if(BUILD_TESTS)
if(BUILD_TESTING)
enable_testing()
add_executable(inja_test
@@ -114,6 +114,7 @@ if(BUILD_BENCHMARK)
target_link_libraries(inja_benchmark PRIVATE inja)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
@@ -122,6 +123,7 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion
)
# build tree package config
configure_file(
cmake/config/injaBuildConfig.cmake.in
@@ -129,14 +131,16 @@ configure_file(
@ONLY
)
install(TARGETS inja EXPORT injaTargets)
export(
EXPORT injaTargets
NAMESPACE pantor::
FILE "${CMAKE_CURRENT_BINARY_DIR}/injaTargets.cmake"
)
# build tree package config
configure_file(
cmake/config/injaBuildConfig.cmake.in
@@ -144,6 +148,7 @@ configure_file(
@ONLY
)
if (INJA_INSTALL)
set(INJA_CONFIG_PATH "lib/cmake/inja")
@@ -163,7 +168,7 @@ if (INJA_INSTALL)
)
install(
FILES
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${INJA_CONFIG_PATH}/injaConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/injaConfigVersion.cmake"
DESTINATION ${INJA_CONFIG_PATH}
@@ -176,6 +181,7 @@ if (INJA_INSTALL)
)
endif()
if (INJA_EXPORT)
export(PACKAGE inja)
endif()

View File

@@ -39,6 +39,8 @@ You can also integrate inja in your project using [Hunter](https://github.com/ru
If you are using [vcpkg](https://github.com/Microsoft/vcpkg) on your project for external dependencies, then you can use the [inja package](https://github.com/Microsoft/vcpkg/tree/master/ports/inja). Please see the vcpkg project for any issues regarding the packaging.
If you are using [cget](https://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install pantor/inja`. A specific version can be installed with `cget install pantor/inja@v2.1.0`.
## Tutorial

View File

@@ -14,14 +14,14 @@ inja_dep = declare_dependency(
amalg_script = files('scripts/update_single_include.sh')
amalg_files = files(
'include/inja/inja.hpp',
'include/inja/inja.hpp',
'include/inja/renderer.hpp',
'include/inja/environment.hpp',
)
)
amalg_tgt = run_target( 'amalg',
amalg_tgt = run_target( 'amalg',
command: amalg_script
)
)
inja_test = executable(

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
nlohmann/json@v3.5.0