mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
FindPython: Avoid implicit link library on Windows
Starting with version 3.14, on Windows, by specifying macro Py_NO_LINK_LIB, the python library is no longer implicitly specified at the link step. Fixes: #26756
This commit is contained in:
@@ -4069,7 +4069,11 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
|
|||||||
set_property (TARGET ${__name}
|
set_property (TARGET ${__name}
|
||||||
PROPERTY INTERFACE_COMPILE_DEFINITIONS "${${_PYTHON_PREFIX}_DEFINITIONS}")
|
PROPERTY INTERFACE_COMPILE_DEFINITIONS "${${_PYTHON_PREFIX}_DEFINITIONS}")
|
||||||
endif()
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
# avoid implicit library link (recognized by version 3.14 and upper)
|
||||||
|
set_property (TARGET ${__name}
|
||||||
|
APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "Py_NO_LINK_LIB")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (${_PYTHON_PREFIX}_${_PREFIX}LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_${_PREFIX}LIBRARY_RELEASE)
|
if (${_PYTHON_PREFIX}_${_PREFIX}LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_${_PREFIX}LIBRARY_RELEASE)
|
||||||
# System manage shared libraries in two parts: import and runtime
|
# System manage shared libraries in two parts: import and runtime
|
||||||
@@ -4131,6 +4135,11 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
|
|||||||
set_property (TARGET ${__name}
|
set_property (TARGET ${__name}
|
||||||
PROPERTY INTERFACE_COMPILE_DEFINITIONS "${${_PYTHON_PREFIX}_DEFINITIONS}")
|
PROPERTY INTERFACE_COMPILE_DEFINITIONS "${${_PYTHON_PREFIX}_DEFINITIONS}")
|
||||||
endif()
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
# avoid implicit library link (recognized by version 3.14 and upper)
|
||||||
|
set_property (TARGET ${__name}
|
||||||
|
APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "Py_NO_LINK_LIB")
|
||||||
|
endif()
|
||||||
|
|
||||||
# When available, enforce shared library generation with undefined symbols
|
# When available, enforce shared library generation with undefined symbols
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
Reference in New Issue
Block a user