From 3991f15c89b83b4d26e7811ab68109ddd3a82cba Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 12 Nov 2024 15:11:22 +0100 Subject: [PATCH] Reorder compile options to have user-defined last The previous version would put the user-defined options first. However, the default options include e.g., -Wall. If a user tries to override (see for instance the next commit) -Wall or other options might override this and not honor the user choice. To always have the user have the last work, put user-defined compile options last. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac21ab5d5..1de118a383 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,9 +175,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang endif() set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu11 -funroll-loops") + "${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu11 -funroll-loops ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11") + "${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11 ${CMAKE_CXX_FLAGS}") add_boolean_option(SANITIZE_ADDRESS False "enable the address sanitizer (ASan)" ON)