Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to fc39 #1419

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
build: Fix cmake warning
Fix the following CMake warning in recent versions:

"CMake Warning (dev) at CMakeLists.txt:231 (FIND_PACKAGE):
 Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
 are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
 the cmake_policy command to set the policy and suppress this warning.

 This warning is for project developers.  Use -Wno-dev to suppress it."

Signed-off-by: Edward Srouji <[email protected]>
  • Loading branch information
EdwardSro committed Jan 22, 2024
commit 1462a873796b1be8df48ce4a3e50c5632ceb1fee
39 changes: 27 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,27 @@ if (NOT HAVE_WORKING_WERROR)
message(FATAL_ERROR "-Werror doesn't work (compiler always creates warnings?). Werror is required for CMake.")
endif()

# Look for Python. We prefer some variant of python 3 if the system has it.
FIND_PACKAGE(PythonInterp 3 QUIET)
if (PythonInterp_FOUND)
# pyverbs can only use python3:
if (NO_PYVERBS)
set(CYTHON_EXECUTABLE "")
# Use Python modules based on CMake version for backward compatibility
set(CYTHON_EXECUTABLE "")
if (${CMAKE_VERSION} VERSION_LESS "3.12")
# Look for Python. We prefer some variant of python 3 if the system has it
FIND_PACKAGE(PythonInterp 3 QUIET)
if (PythonInterp_FOUND)
# pyverbs can only use python3:
if (NOT NO_PYVERBS)
FIND_PACKAGE(cython)
endif()
else()
FIND_PACKAGE(cython)
# But we still must have python (be it 2) for the build process
FIND_PACKAGE(PythonInterp REQUIRED)
endif()
else()
# But we still must have python (be it 2) for the build process:
FIND_PACKAGE(PythonInterp REQUIRED)
set(CYTHON_EXECUTABLE "")
# FindPython looks preferably for Python3. If not found, version 2 is searched
FIND_PACKAGE(Python COMPONENTS Interpreter REQUIRED)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
if (NOT NO_PYVERBS AND Python_VERSION_MAJOR EQUAL 3)
FIND_PACKAGE(cython)
endif()
endif()

find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")
Expand Down Expand Up @@ -450,8 +458,15 @@ if (CYTHON_EXECUTABLE)
# find a matching -devel installation but will happily return a non-matching
# one too. We need them both to match exactly to guarantee cython does the
# right thing.
FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
EXACT REQUIRED)
if (${CMAKE_VERSION} VERSION_LESS "3.12")
FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
EXACT REQUIRED)
else()
FIND_PACKAGE(Python ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}
EXACT COMPONENTS Development REQUIRED)
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
set(PYTHON_INCLUDE_DIRS ${Python_INCLUDE_DIRS})
endif()

# Get a default installation path
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
Expand Down