CMake: Build Python binary modules as MODULE, never SHARED

This commit is contained in:
Sam Edwards 2018-04-05 16:06:16 -06:00
parent 411e0ee93f
commit cfd603bb8d
2 changed files with 14 additions and 4 deletions

View File

@ -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)

View File

@ -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)