From aa9b03df255fcf4faad2b577db7eed463b27f4a5 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 23 Oct 2024 19:48:07 +0200 Subject: [PATCH] [cmake] generate full buildflags.h CFLAGS Combine current configuration flags with CMAKE_C_FLAGS --- include/CMakeLists.txt | 6 ++++++ include/config/buildflags.h.in | 2 +- uwac/templates/CMakeLists.txt | 7 +++++++ uwac/templates/buildflags.h.in | 2 +- winpr/include/CMakeLists.txt | 6 ++++++ winpr/include/config/buildflags.h.in | 2 +- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 8290fa242..b43b5bb9e 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -38,6 +38,12 @@ if (WIN32) string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PROXY_PLUGINDIR "${NATIVE_FREERDP_PROXY_PLUGINDIR}") endif() +set(C_FLAGS ${CMAKE_C_FLAGS}) +if (CMAKE_BUILD_TYPE) + string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE) + string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}") +endif() + cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/version.h) cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/build-config.h) cleaning_configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/config.h) diff --git a/include/config/buildflags.h.in b/include/config/buildflags.h.in index 3a286f233..ed9dfca53 100644 --- a/include/config/buildflags.h.in +++ b/include/config/buildflags.h.in @@ -1,7 +1,7 @@ #ifndef FREERDP_BUILD_FLAGS_H #define FREERDP_BUILD_FLAGS_H -#define FREERDP_CFLAGS "${CMAKE_C_FLAGS}" +#define FREERDP_CFLAGS "${C_FLAGS}" #define FREERDP_COMPILER_ID "${CMAKE_C_COMPILER_ID}" #define FREERDP_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" #define FREERDP_TARGET_ARCH "${TARGET_ARCH}" diff --git a/uwac/templates/CMakeLists.txt b/uwac/templates/CMakeLists.txt index b5e506bdf..427077897 100644 --- a/uwac/templates/CMakeLists.txt +++ b/uwac/templates/CMakeLists.txt @@ -32,6 +32,13 @@ FOREACH(var ${res}) LIST(APPEND UWAC_BUILD_CONFIG_LIST "${var}=${${var}}") ENDIF() ENDFOREACH() + +set(C_FLAGS ${CMAKE_C_FLAGS}) +if (CMAKE_BUILD_TYPE) + string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE) + string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}") +endif() + string(REPLACE ";" " " UWAC_BUILD_CONFIG "${UWAC_BUILD_CONFIG_LIST}") cleaning_configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/version.h) cleaning_configure_file(buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/buildflags.h) diff --git a/uwac/templates/buildflags.h.in b/uwac/templates/buildflags.h.in index d16dfb96c..2ac4d949b 100644 --- a/uwac/templates/buildflags.h.in +++ b/uwac/templates/buildflags.h.in @@ -1,7 +1,7 @@ #ifndef UWAC_BUILD_FLAGS_H #define UWAC_BUILD_FLAGS_H -#define UWAC_CFLAGS "${CMAKE_C_FLAGS}" +#define UWAC_CFLAGS "${C_FLAGS}" #define UWAC_COMPILER_ID "${CMAKE_C_COMPILER_ID}" #define UWAC_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" #define UWAC_TARGET_ARCH "${TARGET_ARCH}" diff --git a/winpr/include/CMakeLists.txt b/winpr/include/CMakeLists.txt index 7bbd89d1a..0717d20d3 100644 --- a/winpr/include/CMakeLists.txt +++ b/winpr/include/CMakeLists.txt @@ -15,6 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(C_FLAGS ${CMAKE_C_FLAGS}) +if (CMAKE_BUILD_TYPE) + string(TOUPPER "${CMAKE_BUILD_TYPE}" CAPS_BUILD_TYPE) + string(APPEND C_FLAGS " ${CMAKE_C_FLAGS_${CAPS_BUILD_TYPE}}") +endif() + cleaning_configure_file(config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h) cleaning_configure_file(config/wtypes.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h) cleaning_configure_file(config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/build-config.h) diff --git a/winpr/include/config/buildflags.h.in b/winpr/include/config/buildflags.h.in index 1e43c37ee..124c43d03 100644 --- a/winpr/include/config/buildflags.h.in +++ b/winpr/include/config/buildflags.h.in @@ -1,7 +1,7 @@ #ifndef WINPR_BUILD_FLAGS_H #define WINPR_BUILD_FLAGS_H -#define WINPR_CFLAGS "${CMAKE_C_FLAGS}" +#define WINPR_CFLAGS "${C_FLAGS}" #define WINPR_COMPILER_ID "${CMAKE_C_COMPILER_ID}" #define WINPR_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" #define WINPR_TARGET_ARCH "${TARGET_ARCH}"