find Boost.Python 3 on older Boost versions
@@ -28,10 +28,29 @@ if (OPENEXR_BUILD_PYTHON_LIBS)
message(FATAL_ERROR "Python is a required dependency when OPENEXR_BUILD_PYTHON_LIBS is set")
endif()
+ find_package(Boost)
+ # Boost.Python use a new versioning scheme starting with Boost 1.67
+ if(Boost_VERSION VERSION_GREATER_EQUAL 106700)
find_package(Boost COMPONENTS python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR})
if(NOT Boost_PYTHON${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR}_FOUND)
message(WARNING "user provided Boost Python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR} was not found. Trying default path...")
+ set(FIND_DEFAULT_PYTHON TRUE)
+ endif()
+
+ else()
+ # older Boost versions < 1.67
+ if(OPENEXR_PYTHON_MAJOR VERSION_GREATER_EQUAL 3)
+ find_package(Boost COMPONENTS python${OPENEXR_PYTHON_MAJOR})
+ if(NOT Boost_PYTHON${OPENEXR_PYTHON_MAJOR}_FOUND)
+ message(WARNING "user provided Boost Python${OPENEXR_PYTHON_MAJOR} was not found. Trying default path...")
+ set(FIND_DEFAULT_PYTHON TRUE)
+ endif()
+ else()
+ set(FIND_DEFAULT_PYTHON TRUE)
+ endif()
+ endif()
+ if(FIND_DEFAULT_PYTHON)
find_package(Boost COMPONENTS python)
if(NOT Boost_PYTHON_FOUND)
message(WARNING "Make boost Python available to CMake's search path, and re-run configuration")
