From c656b9ce0d8727302fea126d2ad70c36ce99f9e8 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Mon, 13 Jul 2020 00:41:25 +0200 Subject: [PATCH] Use CMake's own FindBoost module to detect Boost Python Introduces BOOSTPYTHON_VERSION_MAJOR_MINOR for packaging. Signed-off-by: Andreas Sturmlechner --- CMakeLists.txt | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d05dae46..1c792102 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,8 @@ endif() include(KigConfigureChecks.cmake) -find_package(BoostPython) +set(BOOSTPYTHON_VERSION_MAJOR_MINOR python37 CACHE STRING "Version of BoostPython to feed CMake's FindBoost") +find_package(Boost 1.70 COMPONENTS ${BOOSTPYTHON_VERSION_MAJOR_MINOR}) if(KF6DocTools_FOUND) add_subdirectory( doc ) @@ -67,15 +68,15 @@ add_subdirectory( mimetypes ) add_subdirectory( macros ) add_subdirectory( pykig ) -if(BoostPython_FOUND) +if(Boost_FOUND) + find_package(PythonLibs 3 REQUIRED) + include_directories(${PYTHON_INCLUDE_DIRS}) add_subdirectory( scripting ) add_definitions(-DKIG_ENABLE_PYTHON_SCRIPTING) endif() set_package_properties( - BoostPython PROPERTIES - DESCRIPTION "Python scripting support in Boost" - URL "https://www.boost.org/" + Boost PROPERTIES TYPE OPTIONAL PURPOSE "Kig can optionally use Boost.Python for Python scripting" ) @@ -93,9 +94,6 @@ endif() feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) include_directories( ${CMAKE_SOURCE_DIR}/modes ) -if(BoostPython_FOUND) - include_directories(${BoostPython_INCLUDE_DIRS}) -endif() # kigpart @@ -345,7 +343,7 @@ ki18n_wrap_ui(kigpart_PART_SRCS misc/kigcoordinateprecisiondialog.ui ) -if(BoostPython_FOUND) +if(Boost_FOUND) set(kigpart_PART_SRCS ${kigpart_PART_SRCS} modes/popup/scriptactionsprovider.cc scripting/newscriptwizard.cc @@ -376,8 +374,8 @@ target_link_libraries(kigpart KF6::Archive ) -if(BoostPython_FOUND) - target_link_libraries(kigpart ${BoostPython_LIBRARIES} KF6::TextEditor) +if(Boost_FOUND) + target_link_libraries(kigpart Boost::${BOOSTPYTHON_VERSION_MAJOR_MINOR} ${PYTHON_LIBRARIES} KF6::TextEditor) endif() if (Qt${QT_MAJOR_VERSION}XmlPatterns_FOUND) -- 2.50.1