From 0d3e5e1c26ad166327897b3fe044b4b3b3e3f2a9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 10 May 2022 11:16:24 +0200 Subject: [PATCH] CMake: find boost_python as well On FreeBSD, at least, `find_package(Boost COMPONENTS python)` doesn't work well, while `find_package(boost_python)` does the job. Be somewhat more flexible: look for boost_python first, assuming it pulls in the rest of the Boost bits it needs. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d495ae439..817e7e0c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -390,8 +390,14 @@ endif() add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") if(Python_Development_FOUND) - find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python) - set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") + find_package(boost_python) + if(NOT TARGET Boost::python) + find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python) + set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") + else() + message(STATUS "Found boost_python with target Boost::python") + set(Boost_FOUND ON) + endif() endif() if(NOT Python_Development_FOUND OR NOT Boost_FOUND)