Add ExprTk_BUILD_TESTING flag to enable testing

Also move the tests in a tests directory
This commit is contained in:
Spiros Tsalikis 2023-02-25 14:56:00 -05:00
parent 03c2487999
commit 2c35cb4e74
5 changed files with 26 additions and 0 deletions

View File

@ -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 ()

18
tests/CMakeLists.txt Normal file
View File

@ -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)