From 77876cacbf5c9d3a81d4a6b5bbfe7827f31d4657 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:37:29 +0100 Subject: [PATCH] cmake: Move `CMAKE_C_FLAGS` deduplication after enabling C language --- CMakeLists.txt | 7 ++----- src/CMakeLists.txt | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5d3a243d262d..ba250ea1e2219 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -587,11 +587,8 @@ target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITION target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO}) target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG}) -# If {C,CXX,LD}FLAGS variables are defined during building depends and -# configuring this build system, their content might be duplicated. -if(DEFINED ENV{CFLAGS}) - deduplicate_flags(CMAKE_C_FLAGS) -endif() +# If the {CXX,LD}FLAGS environment variables are defined during building depends +# and configuring this build system, their content might be duplicated. if(DEFINED ENV{CXXFLAGS}) deduplicate_flags(CMAKE_CXX_FLAGS) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 800922596f02a..657c0fde55d9f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,6 +66,11 @@ foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES) string(TOUPPER "${config}" config) set(CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_RELWITHDEBINFO}") endforeach() +# If the CFLAGS environment variable is defined during building depends +# and configuring this build system, its content might be duplicated. +if(DEFINED ENV{CFLAGS}) + deduplicate_flags(CMAKE_C_FLAGS) +endif() set(CMAKE_EXPORT_COMPILE_COMMANDS OFF) add_subdirectory(secp256k1) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)