File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,14 +259,6 @@ if(PY_VERSION_MAJOR VERSION_GREATER 2)
259259 set (IS_PY2 0)
260260endif ()
261261
262- # Convenience boolean variables to easily test the type of python library being build
263- set (BUILD_STATIC 1)
264- set (BUILD_SHARED 0)
265- if (BUILD_LIBPYTHON_SHARED)
266- set (BUILD_STATIC 0)
267- set (BUILD_SHARED 1)
268- endif ()
269-
270262# Options depending of the python version
271263if (IS_PY2)
272264 option (Py_USING_UNICODE "Enable unicode support" ON )
@@ -297,10 +289,6 @@ set(LIBPYTHON python${LIBPYTHON_VERSION})
297289# Proceed to the configure checks
298290include (cmake/ConfigureChecks.cmake )
299291
300- if (NOT BUILD_SHARED AND NOT BUILD_STATIC)
301- message (FATAL_ERROR "One or both of BUILD_SHARED or BUILD_STATIC must be set" )
302- endif ()
303-
304292# Set PYTHONHOME
305293set (LIBDIR "Lib" ) # See Lib/distutils/sysconfig.py - function 'get_python_lib'
306294if (UNIX )
@@ -417,7 +405,7 @@ file(WRITE ${CONFIG_BUILD_DIR}/PythonTargets.cmake "")
417405# Define python executable wrapper command to ensure
418406# python executable resolves the expected python library.
419407set (PYTHON_WRAPPER_COMMAND )
420- if (BUILD_SHARED AND UNIX )
408+ if (BUILD_LIBPYTHON_SHARED AND UNIX )
421409 set (_envvar LD_LIBRARY_PATH)
422410 if (APPLE )
423411 set (_envvar DYLD_LIBRARY_PATH)
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ function(add_python_extension name)
150150 set_property (GLOBAL APPEND PROPERTY extension_${name}_link_libraries ${ADD_PYTHON_EXTENSION_LIBRARIES} )
151151 set_property (GLOBAL APPEND PROPERTY extension_${name}_includedirs ${ADD_PYTHON_EXTENSION_INCLUDEDIRS} )
152152 set_property (GLOBAL APPEND PROPERTY extension_${name}_definitions ${ADD_PYTHON_EXTENSION_DEFINITIONS} )
153- elseif (WIN32 AND NOT BUILD_SHARED )
153+ elseif (WIN32 AND NOT BUILD_LIBPYTHON_SHARED )
154154 # Extensions cannot be built against a static libpython on windows
155155 else ()
156156
Original file line number Diff line number Diff line change 33
44@PACKAGE_INIT@
55
6- set (PYTHON_BUILD_SHARED "@BUILD_SHARED@" )
7- set (PYTHON_BUILD_STATIC "@BUILD_STATIC@" )
6+ set (BUILD_LIBPYTHON_SHARED @BUILD_LIBPYTHON_SHARED@)
7+ if (BUILD_LIBPYTHON_SHARED)
8+ set (PYTHON_BUILD_SHARED 1)
9+ set (PYTHON_BUILD_STATIC 0)
10+ else ()
11+ set (PYTHON_BUILD_SHARED 0)
12+ set (PYTHON_BUILD_STATIC 1)
13+ endif ()
814
915set_and_check (PYTHON_CONFIG_DIR "@PACKAGE_CONFIG_DIR_CONFIG@" )
1016set_and_check (PYTHON_INCLUDE_DIR "@PACKAGE_INCLUDE_DIR_CONFIG@" )
Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ if(WIN32)
277277 _ctypes/libffi_msvc/prep_cif.c
278278 _ctypes/libffi_msvc/ffi.c
279279 _ctypes/libffi_msvc/${_ctype_arch_impl}
280- REQUIRES BUILD_SHARED
280+ REQUIRES BUILD_LIBPYTHON_SHARED
281281 INCLUDEDIRS ${SRC_DIR} /Modules/_ctypes/libffi_msvc
282282 )
283283 endif ()
Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ function(add_libpython name type install component)
472472 endif ()
473473endfunction ()
474474
475- if (BUILD_SHARED )
475+ if (BUILD_LIBPYTHON_SHARED )
476476 add_libpython (libpython-shared SHARED 1 Runtime )
477477 set_target_properties (libpython-shared PROPERTIES
478478 ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /${LIBPYTHON_ARCHIVEDIR}
@@ -557,7 +557,7 @@ if(BUILD_SHARED)
557557
558558endif ()
559559
560- if (BUILD_STATIC )
560+ if (NOT BUILD_LIBPYTHON_SHARED )
561561 add_libpython (libpython-static STATIC ${INSTALL_DEVELOPMENT} Development )
562562 if (HAVE_TARGET_COMPILE_DEFINITIONS)
563563 target_compile_definitions (libpython-static PUBLIC Py_NO_ENABLE_SHARED )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ set_property(
1313
1414# Link against the shared libpython if it was built, otherwise use the static
1515# version.
16- if (BUILD_SHARED )
16+ if (BUILD_LIBPYTHON_SHARED )
1717 target_link_libraries (python libpython-shared )
1818else ()
1919 target_link_libraries (python libpython-static )
You can’t perform that action at this time.
0 commit comments