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 <tomli@tomli.me>
pull/118/head
Yifeng Li 2023-05-12 14:21:17 +00:00 committed by Thorsten Liebig
parent 486f3140cb
commit 782a7381bf
1 changed files with 3 additions and 3 deletions

View File

@ -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()