From 6d4cd58cd4b1b2f3906889009da7b71931645e93 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 3 Dec 2019 18:24:04 +0000 Subject: Modernize CMake using backported FindPython module. --- test/CMakeLists.txt | 10 +++++----- test/unit/CMakeLists.txt | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 41eecb36..867abbd4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,14 +15,14 @@ if (HAVE_BOOST_PYTHON) endif() macro(add_ledger_harness_tests _class) - if (PYTHONINTERP_FOUND) + if (Python_EXECUTABLE) file(GLOB ${_class}_TESTS *.test) foreach(TestFile ${${_class}_TESTS}) get_filename_component(TestFile_Name ${TestFile} NAME_WE) string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest) if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON) add_test(NAME ${_class}Test_${TestFile_Name} - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py + COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py $ ${PROJECT_SOURCE_DIR} ${TestFile} ${TEST_PYTHON_FLAGS}) set_tests_properties(${_class}Test_${TestFile_Name} @@ -36,13 +36,13 @@ add_subdirectory(manual) add_subdirectory(baseline) add_subdirectory(regress) -if (PYTHONINTERP_FOUND) +if (Python_EXECUTABLE) set(_class DocTests) file(GLOB ${_class}_TESTS ${PROJECT_SOURCE_DIR}/doc/*.texi) foreach(TestFile ${${_class}_TESTS}) get_filename_component(TestFile_Name ${TestFile} NAME_WE) add_test(NAME ${_class}Test_${TestFile_Name} - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py + COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py --ledger $ --file ${TestFile}) set_tests_properties(${_class}Test_${TestFile_Name} PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}") @@ -53,7 +53,7 @@ if (PYTHONINTERP_FOUND) list(APPEND CheckOptions CheckBaselineTests) #CheckManpage CheckTexinfo foreach(_class ${CheckOptions}) add_test(NAME ${_class} - COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py + COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py --ledger $ --source ${PROJECT_SOURCE_DIR}) set_tests_properties(${_class} PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}") diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 3611b00a..1bd5e4b3 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -9,15 +9,15 @@ include_directories(${PROJECT_SOURCE_DIR}/src) if (BUILD_LIBRARY) add_executable(UtilTests t_times.cc) - if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON) - target_link_libraries(UtilTests ${PYTHON_LIBRARIES}) + if (HAVE_BOOST_PYTHON) + target_link_libraries(UtilTests ${Python_LIBRARIES}) endif() add_ledger_test(UtilTests) add_executable(MathTests t_amount.cc t_commodity.cc t_balance.cc t_expr.cc t_value.cc) set_source_files_properties(t_amount.cc t_value.cc PROPERTIES COMPILE_FLAGS "-Wno-unused-comparison") - if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON) - target_link_libraries(MathTests ${PYTHON_LIBRARIES}) + if (HAVE_BOOST_PYTHON) + target_link_libraries(MathTests ${Python_LIBRARIES}) endif() add_ledger_test(MathTests) endif() -- cgit v1.2.3