From 8228578da6f86d17b9a2a3f8c6053f8b4ee3fb71 Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Thu, 7 Nov 2019 21:06:37 +1300 Subject: [PATCH] Handle python2 not being installed, but python3 being present Signed-off-by: Kimball Thurston --- PyIlmBase/CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/PyIlmBase/CMakeLists.txt b/PyIlmBase/CMakeLists.txt index d5cba6b9df..eee43ebaff 100644 --- a/PyIlmBase/CMakeLists.txt +++ b/PyIlmBase/CMakeLists.txt @@ -45,11 +45,11 @@ endif() find_package(Python2 COMPONENTS Interpreter Development) find_package(Python3 COMPONENTS Interpreter Development) if(TARGET Python2::Python AND TARGET Python3::Python) - message(NOTICE ": Found Python ${Python2_VERSION} and ${Python3_VERSION}") + message(STATUS ": Found Python ${Python2_VERSION} and ${Python3_VERSION}") elseif(TARGET Python2::Python) - message(NOTICE ": Found Python ${Python2_VERSION}") + message(STATUS ": Found Python ${Python2_VERSION}") elseif(TARGET Python3::Python) - message(NOTICE ": Found Python ${Python3_VERSION}") + message(STATUS ": Found Python ${Python3_VERSION}") else() message(WARNING ": Unable to find python development libraries for python 2 or 3") return() @@ -125,9 +125,15 @@ find_package(Boost OPTIONAL_COMPONENTS set(_pyilmbase_have_perver_boost) if(PYILMBASE_BOOST_PY2_COMPONENT) string(TOUPPER ${PYILMBASE_BOOST_PY2_COMPONENT} PYILMBASE_PY2_UPPER) +else() + set(PYILMBASE_BOOST_PY2_COMPONENT python2x_NOTFOUND) + set(PYILMBASE_PY2_UPPER PYTHON2X_NOTFOUND) endif() if(PYILMBASE_BOOST_PY3_COMPONENT) string(TOUPPER ${PYILMBASE_BOOST_PY3_COMPONENT} PYILMBASE_PY3_UPPER) +else() + set(PYILMBASE_BOOST_PY3_COMPONENT python3x_NOTFOUND) + set(PYILMBASE_PY3_UPPER PYTHON3X_NOTFOUND) endif() if(Boost_PYTHON2_FOUND OR Boost_${PYILMBASE_PY2_UPPER}_FOUND) set(_pyilmbase_have_perver_boost TRUE) @@ -167,9 +173,9 @@ else() return() endif() endif() -set(PYILMBASE_PY2_UPPER) -set(PYILMBASE_PY3_UPPER) -set(_pyilmbase_have_perver_boost) +unset(PYILMBASE_PY2_UPPER) +unset(PYILMBASE_PY3_UPPER) +unset(_pyilmbase_have_perver_boost) # unfortunately, we can't use the boost numpy stuff, as that requires a # version of boost that is newer than is mandated by many active versions