Skip to content

Commit

Permalink
Updates to fix broken Windows build.
Browse files Browse the repository at this point in the history
Signed-off-by: Christina Tempelaar-Lietz <[email protected]>
  • Loading branch information
xlietz committed Jan 25, 2020
1 parent fce8c17 commit f9229e9
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions PyIlmBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -87,15 +99,15 @@ 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
# ignore CMAKE_INSTALL_PREFIX. Could extract this to a function somewhere
# 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
Expand Down

0 comments on commit f9229e9

Please sign in to comment.