From 782a7381bf8fb7e2100fa1358f076a1085d21bdd Mon Sep 17 00:00:00 2001 From: Yifeng Li Date: Fri, 12 May 2023 14:21:17 +0000 Subject: [PATCH] CMakeLists.txt: append instead of overwrite CMAKE_CXX_FLAGS Currently, on ARM and PPC, CMakeLists.txt uses: set(CMAKE_CXX_FLAGS "-DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") but this overwrites the default value of CMAKE_CXX_FLAGS from CMake, including user-specified CXXFLAGS via environmental variable, making it impossible to change CXXFLAGS. This patch appends instead of overwrite CMAKE_CXX_FLAGS via: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") Signed-off-by: Yifeng Li --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e11ab1..4c05634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,13 +162,13 @@ endif() if(${ARCH} STREQUAL "x86_64") message(STATUS "Detected 64-bit x86 target") - #set(CMAKE_CXX_FLAGS "-msse -march=native") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -march=native") elseif(${ARCH} STREQUAL "ppc64") message(STATUS "Detected 64-bit POWER target") - set(CMAKE_CXX_FLAGS "-DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") elseif(${ARCH} STREQUAL "aarch64") message(STATUS "Detected 64-bit ARM target") - set(CMAKE_CXX_FLAGS "-DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS") elseif(${ARCH} STREQUAL "unsupported") message(FATAL_ERROR "Unsupported target architecture! Try porting openEMS to your architecture...") else()