From 0ddbf256705f07b9a233f29e9abaf3741a7ff584 Mon Sep 17 00:00:00 2001 From: Mohcine Chraibi <m.chraibi@fz-juelich.de> Date: Sat, 15 Sep 2018 12:33:28 +0200 Subject: [PATCH] detect python 3 --- CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3c51be4..b2030b00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,6 +314,16 @@ if(WIN32) endif() endif() +set(Python_ADDITIONAL_VERSIONS 3.0 3.3 3.6 3.7) +find_package(PythonInterp) +if(PYTHONINTERP_FOUND) + message(STATUS "Found Python: " ${PYTHON_EXECUTABLE}) + message(STATUS "Found Python: " ${PYTHON_VERSION_STRING}) + add_definitions("-DPYTHON=\"${PYTHON_EXECUTABLE}\"") +else() + message (WARNING "Could not find python 3x") +endif(PYTHONINTERP_FOUND) + # ----------------------------- cTest ------------------------------------------ if(BUILD_TESTING) SET(BUILD_TEST_TIMEOUT 10800 CACHE STRING "Global timeout on all tests (seconds).") @@ -342,9 +352,11 @@ if(BUILD_TESTING) endforeach(test_src ${test_files}) - +# set(Python_ADDITIONAL_VERSIONS 3.0) find_package(PythonInterp) if(PYTHONINTERP_FOUND) + message(STATUS "Found Python: " ${PYTHON_EXECUTABLE}) + message(STATUS "Found Python: " ${PYTHON_VERSION_STRING}) foreach (test_src ${test_py_files}) GET_FILENAME_COMPONENT(test ${test_src} NAME_WE) # message (STATUS "Add python test: " ${test} " | test_src: " ${test_src}) -- GitLab