From cfd603bb8db9822c9882ff7f706d36550ad05278 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 5 Apr 2018 16:06:16 -0600 Subject: [PATCH] CMake: Build Python binary modules as MODULE, never SHARED --- cmake/macros/Interrogate.cmake | 6 +++++- dtool/metalibs/dtoolconfig/CMakeLists.txt | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index 0eaf61f2aa..5e29837756 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -286,7 +286,11 @@ function(add_python_module module) COMMENT "Generating module ${module}" ) - add_library(${module} "${module}_module.cxx" ${sources}) + if(BUILD_SHARED_LIBS) + add_library(${module} MODULE "${module}_module.cxx" ${sources}) + else() + add_library(${module} STATIC "${module}_module.cxx" ${sources}) + endif() target_link_libraries(${module} ${link_targets} ${PYTHON_LIBRARIES} p3interrogatedb) diff --git a/dtool/metalibs/dtoolconfig/CMakeLists.txt b/dtool/metalibs/dtoolconfig/CMakeLists.txt index 568c451f47..658cb91cc7 100644 --- a/dtool/metalibs/dtoolconfig/CMakeLists.txt +++ b/dtool/metalibs/dtoolconfig/CMakeLists.txt @@ -1,9 +1,15 @@ add_definitions(-DBUILDING_DTOOLCONFIG) -if(HAVE_PYTHON) - add_library(p3dtoolconfig dtoolconfig.cxx pydtool.cxx) +if(BUILD_SHARED_LIBS) + set(libtype MODULE) else() - add_library(p3dtoolconfig dtoolconfig.cxx) + set(libtype STATIC) +endif() + +if(HAVE_PYTHON) + add_library(p3dtoolconfig ${libtype} dtoolconfig.cxx pydtool.cxx) +else() + add_library(p3dtoolconfig ${libtype} dtoolconfig.cxx) endif() target_use_packages(p3dtoolconfig PYTHON)