From c3caae7734238b46b78676f212ac9680b61a0510 Mon Sep 17 00:00:00 2001 From: JonathanMeans Date: Fri, 28 Feb 2020 12:20:48 -0500 Subject: [PATCH] Handle case where CMake can't find Python interpreter --- CMakeLists-CODA.txt | 14 ++------------ CMakeLists.txt | 6 ++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists-CODA.txt b/CMakeLists-CODA.txt index 2ddf724e8..30a13c211 100644 --- a/CMakeLists-CODA.txt +++ b/CMakeLists-CODA.txt @@ -20,7 +20,7 @@ endif() ExternalProject_Add_Step(coda-oss waf-configure - COMMAND ${Python_EXECUTABLE} waf configure --prefix=${CODA_INSTALL_DIR} "${configure_flags}" + COMMAND ${PYTHON} waf configure --prefix=${CODA_INSTALL_DIR} "${configure_flags}" DEPENDERS build ALWAYS 0 WORKING_DIRECTORY ${CODA_DIR}) @@ -28,20 +28,10 @@ ExternalProject_Add_Step(coda-oss foreach(module ${coda_modules}) ExternalProject_Add_Step(coda-oss waf-build-${module} - COMMAND ${Python_EXECUTABLE} waf install --target=${module} + COMMAND ${PYTHON} waf install --target=${module} DEPENDEES waf-configure DEPENDERS build ALWAYS 0 WORKING_DIRECTORY ${CODA_DIR}) endforeach() -#if(Python_NumPy_FOUND) -# ExternalProject_Add_Step(coda-oss -# waf-build-numpyutils -# COMMAND ${Python_EXECUTABLE} waf install --target=numpyutils-c++ -# DEPENDEES waf-configure -# DEPENDERS build -# ALWAYS 0 -# WORKING_DIRECTORY ${CODA_DIR}) -# -#endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index bc99e7c26..989edd73c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,15 @@ endif() find_package(Python COMPONENTS Interpreter Development NumPy) list(APPEND coda_modules except-c++ io-c++ sys-c++ mt-c++ str-c++ math-c++ xml.lite-c++ JPEG J2K) + if (Python_NumPy_FOUND) list(APPEND coda_modules numpyutils-c++) endif() +if (Python_FOUND) + set(PYTHON ${Python_EXECUTABLE}) +else() + set(PYTHON python) +endif() include(CMakeLists-CODA.txt)