1From 83628b471a1a79dae50bb158fca9448b668dd3a6 Mon Sep 17 00:00:00 2001 2From: Gregory Anders <greg@gpanders.com> 3Date: Wed, 21 Oct 2020 10:43:16 -0600 4Subject: [PATCH] Preserve CXXFLAGS from environment in Mongoose 5 6This allows CXXFLAGS set in the environment to also be used in the CMake 7build process, instead of overwriting them. This is useful in a cross 8compile context where the CXXFLAGS variable might contain necessary 9flags for cross compiling. 10--- 11 Mongoose/CMakeLists.txt | 6 +++--- 12 1 file changed, 3 insertions(+), 3 deletions(-) 13 14diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt 15index 7e134ab..91a7f70 100644 16--- a/Mongoose/CMakeLists.txt 17+++ b/Mongoose/CMakeLists.txt 18@@ -321,14 +321,14 @@ add_test(Unit_Test_EdgeSep ./tests/mongoose_unit_test_edgesep) 19 message(STATUS "CMAKE_CXX_COMPILER: " ${BoldBlue} ${CMAKE_CXX_COMPILER_ID} ${ColourReset}) 20 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") 21 # using Clang 22- SET(CMAKE_CXX_FLAGS "-O3 -fwrapv") 23+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv") 24 # Debug flags for Clang 25 SET(CMAKE_CXX_FLAGS_DEBUG "--coverage -g -fwrapv") 26 SET(CMAKE_C_FLAGS_DEBUG "--coverage -g") 27 SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage -g") 28 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 29 # using GCC 30- SET(CMAKE_CXX_FLAGS "-O3 -fwrapv") 31+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv") 32 # Debug flags for GCC 33 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6") 34 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") 35@@ -339,7 +339,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 36 SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage") 37 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") 38 # using Intel C++ 39- SET(CMAKE_CXX_FLAGS "-O3 -no-prec-div -xHOST -ipo -fwrapv") 40+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -no-prec-div -xHOST -ipo -fwrapv") 41 # Debug flags for Intel 42 SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv") 43 SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall") 44