diff --git a/CMakeLists.txt b/CMakeLists.txt index a0e0075..18c96b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,3 +40,11 @@ determine_version("${CMAKE_CURRENT_SOURCE_DIR}" "${GIT_EXECUTABLE}" "ExprTk") add_library(ExprTk INTERFACE) # set the include directory for the interface library target_include_directories(ExprTk INTERFACE include) + +# create an ExprTK option for building testing +option(ExprTk_BUILD_TESTING "Build ExprTk tests" ON) +# if ExprTk_BUILD_TESTING is set to ON, then build the tests +if (ExprTk_BUILD_TESTING) + enable_testing() + add_subdirectory(tests) +endif () diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..e2cf524 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,18 @@ +# ************************************************************** +# * C++ Mathematical Expression Toolkit Library * +# * * +# * Author: Arash Partow (1999-2023) * +# * URL: https://www.partow.net/programming/exprtk/index.html * +# * * +# * Copyright notice: * +# * Free use of the Mathematical Expression Toolkit Library is * +# * permitted under the guidelines and in accordance with the * +# * most current version of the MIT License. * +# * http://www.opensource.org/licenses/MIT * +# * * +# ************************************************************** + +add_executable(exprtk_test exprtk_test.cpp) +target_link_libraries(exprtk_test ExprTk) + +add_test(NAME exprtk_test COMMAND exprtk_test) diff --git a/exprtk_functional_ext_test.txt b/tests/exprtk_functional_ext_test.txt similarity index 100% rename from exprtk_functional_ext_test.txt rename to tests/exprtk_functional_ext_test.txt diff --git a/exprtk_functional_test.txt b/tests/exprtk_functional_test.txt similarity index 100% rename from exprtk_functional_test.txt rename to tests/exprtk_functional_test.txt diff --git a/exprtk_test.cpp b/tests/exprtk_test.cpp similarity index 100% rename from exprtk_test.cpp rename to tests/exprtk_test.cpp