Skip to content

Commit 10846ad

Browse files
jcfrhjmjohnson
authored andcommitted
cmake: Switch to using FindPython3 CMake module
The FindPythonLib CMake module is deprecated since CMake 3.12 and starting with CMake 3.27 the module is not provided unless CMP0148 is set to OLD. To integrate PythonQt in other project, the CMake variables `Python3_LIBRARY` and `Python3_INCLUDE_DIR` may be set instead of `PYTHON_LIBRARY`, `PYTHON_INCLUDE_DIR` and `PYTHON_INCLUDE_DIR2`. Options `Python3_ROOT_DIR`, `Python3_LIBRARY_DEBUG` and `Python3_LIBRARY_RELEASE` may also be set. Co-authored-by: Hans Johnson <hans-johnson@uiowa.edu>
1 parent 695fcae commit 10846ad

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ set(qtlibs
4343
#-----------------------------------------------------------------------------
4444
# Python libraries
4545

46-
find_package(PythonLibs REQUIRED)
47-
include_directories("${PYTHON_INCLUDE_DIR}")
46+
find_package(Python3 COMPONENTS Development REQUIRED)
4847

4948
#-----------------------------------------------------------------------------
5049
# Build options
@@ -304,7 +303,7 @@ target_include_directories(PythonQt
304303

305304
target_link_libraries(PythonQt
306305
PUBLIC
307-
${PYTHON_LIBRARY}
306+
Python3::Python
308307
${QT_LIBRARIES}
309308
)
310309

0 commit comments

Comments
 (0)