Skip to content

Commit 0ca6305

Browse files
committed
cmake: Move CMAKE_C_FLAGS deduplication after enabling C language
1 parent 8c14d1d commit 0ca6305

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,8 @@ target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITION
586586
target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO})
587587
target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG})
588588

589-
# If {C,CXX,LD}FLAGS variables are defined during building depends and
590-
# configuring this build system, their content might be duplicated.
591-
if(DEFINED ENV{CFLAGS})
592-
deduplicate_flags(CMAKE_C_FLAGS)
593-
endif()
589+
# If the {CXX,LD}FLAGS environment variables are defined during building depends
590+
# and configuring this build system, their content might be duplicated.
594591
if(DEFINED ENV{CXXFLAGS})
595592
deduplicate_flags(CMAKE_CXX_FLAGS)
596593
endif()

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ foreach(config IN LISTS CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES)
6666
string(TOUPPER "${config}" config)
6767
set(CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
6868
endforeach()
69+
# If the CFLAGS environment variable is defined during building depends
70+
# and configuring this build system, its content might be duplicated.
71+
if(DEFINED ENV{CFLAGS})
72+
deduplicate_flags(CMAKE_C_FLAGS)
73+
endif()
6974
set(CMAKE_EXPORT_COMPILE_COMMANDS OFF)
7075
add_subdirectory(secp256k1)
7176
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

0 commit comments

Comments
 (0)