Skip to content

Commit

Permalink
Improve support for installing with cget (#88)
Browse files Browse the repository at this point in the history
* Improve support for installing with cget

* add specific version, clean cmake

* fix version to "v2.1.0"
  • Loading branch information
pfultz2 authored and pantor committed Feb 16, 2019
1 parent 89652ca commit 4c0ee3a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -82,7 +82,7 @@ if (COVERALLS)
endif()


if(BUILD_TESTS)
if(BUILD_TESTING)
enable_testing()

add_executable(inja_test
Expand Down Expand Up @@ -114,6 +114,7 @@ if(BUILD_BENCHMARK)
target_link_libraries(inja_benchmark PRIVATE inja)
endif()


include(CMakePackageConfigHelpers)

write_basic_package_version_file(
Expand All @@ -122,28 +123,32 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion
)


# build tree package config
configure_file(
cmake/config/injaBuildConfig.cmake.in
injaConfig.cmake
@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
injaConfig.cmake
@ONLY
)


if (INJA_INSTALL)
set(INJA_CONFIG_PATH "lib/cmake/inja")

Expand All @@ -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}
Expand All @@ -176,6 +181,7 @@ if (INJA_INSTALL)
)
endif()


if (INJA_EXPORT)
export(PACKAGE inja)
endif()
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]`.


## Tutorial

Expand Down
8 changes: 4 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nlohmann/[email protected]

0 comments on commit 4c0ee3a

Please sign in to comment.