Avoids the annoying warning messages such as:
```
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
```
and allows to get rid of the policy definition
This ensures that the correct include and library directories are used
regardless of operating system target by leveraging the built-in
GNUInstallDirs logic for determining the right directory paths.
This also fixes the path for the CMake config module files to use
the right location for header-only libraries.
A pc(5) file for pkgconfig is now also created and installed.
* Fixed headers and linter marks applied
Headers were wrong.
Applied some linter suggestions. There are still many left.
* CMake adjusted for single header
CMake can now install the single header.
Removed an unneeded header.
---------
Co-authored-by: Berscheid <1885260+pantor@users.noreply.github.com>
* test
* improve ast
* add if statement
* shunting-yard start
* renderer as node visitor
* improve ast
* improve ast further
* first functions
* improve ast v3
* improve ast v4
* fix parser error location
* nested ifs
* fix comma, activate more tests
* fix line statements
* fix some more tests
* fix callbacks without arguments
* add json literal array and object
* use switch in expression
* fix default function
* fix loop data
* improved tests and benchmark
* fix minus numbers
* improve all
* fix warnings, optimizations
* fix callbacks argument order
* dont move loop parent
* a few more test
* fix clang-3
* fix pointers
* clean
* update single include
* add function to get position of current token
* new exception parser_error with error location
* parser throws parser_error with error location
* update single include
* get error position in text
* bump to 2.3
* subclass exceptions
* update single include from every directory
* center badges in readme
* github ci windows, mac
* use default compiler
* check ci
* fix ci
* test ci
* fix ci
* fix ci
* test ci
* badges to github action
* add check for single include
* fix check
* check (should fail)
* fix all ci
* add artifact in single include ci
* update to newest nlohmann/json
* move unit tests to doctest
* move to json v3.6.1
* add function to get position of current token
* new exception parser_error with error location
* parser throws parser_error with error location
* update single include
* get error position in text
* bump to 2.3
* subclass exceptions
Co-authored-by: pantor <lars.berscheid@online.de>
Currently Inja's CMake config will build unit tests as long as `BUILD_TESTING` is enabled. As a result, when including Inja in another CMake project, it is not possible to build the latter's unit tests without also enabling Inja's own unit tests.
It's common for libraries to include a separate option for controlling its own unit test targets, in addition to observing the global `BUILD_TESTING` option. For instance, nlohmann/json has a `JSON_BuildTests` option: 973c52dd4a/CMakeLists.txt (L18)
Also see https://cliutils.gitlab.io/modern-cmake/chapters/testing.html .
This commit adds a `INJA_BUILD_TESTS` flag to address this.
* throw exception if a file cannot be opened
* Add a new function in utils.hpp: open_file_or_throw: This function
returns an opened std::ifstream or throws by calling `inja_throw`.
* Use this function in Parser::load_file which previously returned an
empty string if the file couldn't be opened.
* Use this function in Environment::load_json which previously threw
a `nlohmann::detail::parse_error` if the file couldn't be opened.
* In Parser::parse_statement: When including files through `include`,
do not attempt to (re-)parse templates from files that were already
included. Additionally, this prevents inja from attempting to load
in-memory templates by their name from disk.
* Add tests that check if an exception is thrown when attempting to
open files that do not exist.
* cmake: enable C++11
* cmake: require C++11 when depending on single_inja
* code style
- You can now update the single include file in a meson build by using
the target 'amalg'.
- The meson build also now builds the single include test suite.
- cmake build updated to use the new script to update the single
include.