From f9229e98c93b4bc0179bb12904d03071cc5a8718 Mon Sep 17 00:00:00 2001 From: Christina Tempelaar-Lietz Date: Mon, 20 Jan 2020 07:54:03 +0000 Subject: [PATCH] Updates to fix broken Windows build. Signed-off-by: Christina Tempelaar-Lietz --- PyIlmBase/CMakeLists.txt | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/PyIlmBase/CMakeLists.txt b/PyIlmBase/CMakeLists.txt index eee43ebaff..4f8db6039e 100644 --- a/PyIlmBase/CMakeLists.txt +++ b/PyIlmBase/CMakeLists.txt @@ -44,14 +44,26 @@ endif() # now determine which (or both), and compile for both find_package(Python2 COMPONENTS Interpreter Development) find_package(Python3 COMPONENTS Interpreter Development) -if(TARGET Python2::Python AND TARGET Python3::Python) - message(STATUS ": Found Python ${Python2_VERSION} and ${Python3_VERSION}") -elseif(TARGET Python2::Python) +if(Python2_FOUND) message(STATUS ": Found Python ${Python2_VERSION}") -elseif(TARGET Python3::Python) +elseif(Python2_Python) + message(WARNING ": Found Python ${Python2_VERSION} development libraries, but no interpreter") +elseif(Python2_EXECUTABLE) + message(WARNING ": Found Python ${Python2_VERSION} interpreter, but no development libraries") +else() + message(WARNING ": Unable to find Python ${Python2_VERSION} interpreter or development libraries") +endif() +if(Python3_FOUND) message(STATUS ": Found Python ${Python3_VERSION}") +elseif(Python3_Python) + message(WARNING ": Found Python ${Python3_VERSION} development libraries, but no interpreter") +elseif(Python3_EXECUTABLE) + message(WARNING ": Found Python ${Python3_VERSION} interpreter, but no development libraries") else() - message(WARNING ": Unable to find python development libraries for python 2 or 3") + message(WARNING ": Unable to find Python ${Python3_VERSION} interpreter or development libraries") +endif() +if (NOT Python2_FOUND AND NOT Python3_FOUND) + message(WARNING ": Disabling PyIlmBase") return() endif() @@ -87,7 +99,7 @@ function(PYILMBASE_EXTRACT_REL_SITEARCH varname pyver pyexe pysitearch) message(STATUS " -> Will install to: ${_reldir}") endfunction() -if (TARGET Python2::Python) +if(Python2_FOUND) set(PYILMBASE_BOOST_PY2_COMPONENT "python${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}") message(STATUS "Found Python2 libraries: ${Python2_VERSION_MAJOR}${Python2_VERSION_MINOR}") # we can't just use the Python2_SITEARCH variable as that then will @@ -95,7 +107,7 @@ if (TARGET Python2::Python) # if it is generally useful pyilmbase_extract_rel_sitearch(PyIlmBase_Python2_SITEARCH_REL 2 ${Python2_EXECUTABLE} ${Python2_SITEARCH}) endif() -if (TARGET Python3::Python) +if(Python3_FOUND) set(PYILMBASE_BOOST_PY3_COMPONENT "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") message(STATUS "Found Python3 libraries: ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}") # and figure out the install root here