From 285e55333fd59f8275254cbc272eee3bbf01143f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 27 Apr 2020 14:05:08 -0400 Subject: [PATCH] bpo-38728: Update PC/pyconfig.h to allow disabling pragma based auto-linking Define PY_NO_LINK_LIB to build extension disabling pragma based auto-linking. This is relevant when using build-system generator (e.g CMake) where the linking is explicitly handled --- PC/pyconfig.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 02216b50680..5a53f24623a 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -264,10 +264,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ #ifdef MS_COREDLL # if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN) /* not building the core - must be an ext */ -# if defined(_MSC_VER) +# if defined(_MSC_VER) && !defined(PY_NO_LINK_LIB) /* So MSVC users need not specify the .lib file in their Makefile (other compilers are generally taken care of by distutils.) */ + /* Define PY_NO_LINK_LIB to build extension disabling pragma + based auto-linking. + This is relevant when using build-system generator (e.g CMake) where + the linking is explicitly handled */ # if defined(_DEBUG) # pragma comment(lib,"python39_d.lib") # elif defined(Py_LIMITED_API)