From bb61350ae5c0175699b048d08a98e184447e6e2a Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 31 Jul 2023 12:37:09 +0200 Subject: [PATCH] CMake: replace FindPythonIntp with FindPython3 The earlier were deprecated since CMake 3.12. Since CMake 3.27 this causes deprecation warnings. Should be safe nowadays to require CMake 3.12. Signed-off-by: Frank Lichtenheld --- CMakeLists.txt | 2 +- client/CMakeLists.txt | 4 ++-- cmake/findswigdeps.cmake | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3febe7906..7d354da1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.12) cmake_policy(SET CMP0048 NEW) project(OpenVPN3-core VERSION 3) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 0987cfd40..e8921e8ef 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -16,8 +16,8 @@ if (${BUILD_SWIG_LIB}) ) add_core_dependencies(ovpnclilib) - target_link_libraries(ovpnclilib ${PYTHON_LIBRARIES}) - target_include_directories(ovpnclilib PRIVATE ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries(ovpnclilib ${Python3_LIBRARIES}) + target_include_directories(ovpnclilib PRIVATE ${Python3_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) # Use proper python library name to generate _ovpncli.so/dylib/dll set_target_properties(ovpnclilib PROPERTIES OUTPUT_NAME "_ovpncli") diff --git a/cmake/findswigdeps.cmake b/cmake/findswigdeps.cmake index c2faec3f4..9bc3139b3 100644 --- a/cmake/findswigdeps.cmake +++ b/cmake/findswigdeps.cmake @@ -1,11 +1,10 @@ -find_package(PythonInterp) -find_package(PythonLibs) +find_package(Python3 COMPONENTS Interpreter Development) FIND_PACKAGE(SWIG 3.0) # We test building this library with python instead of java since that is easier to do and both languages should work -if (PYTHONLIBS_FOUND AND SWIG_FOUND) +if (Python3_Development_FOUND AND SWIG_FOUND) if (NOT WIN32) set(BUILD_SWIG_LIB TRUE) elseif("${CMAKE_EXE_LINKER_FLAGS}" MATCHES "x64")