From af38d0f6ce7b0bdf8783624e9efabfc7588c6c55 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 7 Jan 2020 15:59:26 +0100 Subject: [PATCH] Fix module compilation flags --- CMakeLists.txt | 3 +++ cmake/makefile-variables.in | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c451e4ee9..0a878acf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -575,6 +575,9 @@ if(UNIX) # Makefile set(MAKEFILE_LDSHARED_FLAGS "-shared") + string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) + set(MAKEFILE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}") + set(MAKEFILE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}") if(APPLE) set(MAKEFILE_LDSHARED_FLAGS "-dynamiclib -headerpad_max_install_names -undefined dynamic_lookup") endif() diff --git a/cmake/makefile-variables.in b/cmake/makefile-variables.in index 5dd942cbb..cbc5d9ae5 100644 --- a/cmake/makefile-variables.in +++ b/cmake/makefile-variables.in @@ -42,13 +42,13 @@ INSTALL_SHARED= ${INSTALL} -m 555 MAKESETUP= $(srcdir)/Modules/makesetup # Compiler options -OPT= @CMAKE_C_FLAGS@ -DNDEBUG +OPT= @MAKEFILE_C_FLAGS@ -DNDEBUG BASECFLAGS= -Wno-unused-result -Wsign-compare -Wunreachable-code -CFLAGS= @CMAKE_C_FLAGS@ +CFLAGS= @MAKEFILE_C_FLAGS@ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to # be able to build extension modules using the directories specified in the # environment variables -CPPFLAGS= @CMAKE_CXX_FLAGS@ +CPPFLAGS= @MAKEFILE_CXX_FLAGS@ LDFLAGS= LDLAST= SGI_ABI= @@ -58,7 +58,7 @@ ARFLAGS= rc # Extra C flags added for building the interpreter object files. CFLAGSFORSHARED= # C flags used for building the interpreter object files -PY_CFLAGS= @CMAKE_C_FLAGS@ -DPy_BUILD_CORE +PY_CFLAGS= @MAKEFILE_C_FLAGS@ -DPy_BUILD_CORE # Machine-dependent subdirectories