Skip to content

Commit 060b54f

Browse files
committed
Allow proper overriding of CXXFLAGS.
1 parent 3cfa675 commit 060b54f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ else()
140140
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_hypot=hypot -std=c++14 -g -fomit-frame-pointer -fstrict-aliasing -Wall -Wextra -Werror -Wno-missing-field-initializers")
141141
endif()
142142
else()
143-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fomit-frame-pointer -fstrict-aliasing -fPIC -Wall -Wextra -Werror -Wno-missing-field-initializers")
143+
set(DYND_CXX_FLAGS "-g -fomit-frame-pointer -fstrict-aliasing -fPIC -Wall -Wextra -Werror -Wno-missing-field-initializers")
144144
endif()
145145
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
146146
if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.9)
147147
message(FATAL_ERROR "Only GCC 4.9 and later are supported by DyND. Found version ${CMAKE_CXX_COMPILER_VERSION}.")
148148
endif()
149-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fmax-errors=20")
149+
set(DYND_CXX_FLAGS "${DYND_CXX_FLAGS} -std=c++14 -fmax-errors=20")
150150
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
151-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -ferror-limit=20 -Wdocumentation")
151+
set(DYND_CXX_FLAGS "${DYND_CXX_FLAGS} -std=c++1y -ferror-limit=20 -Wdocumentation")
152152
endif()
153153
endif()
154154

@@ -157,10 +157,12 @@ if(MSVC)
157157
else()
158158
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
159159
if(APPLE)
160-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-unused-function -Wno-error")
160+
set(DYND_CXX_FLAGS "${DYND_CXX_FLAGS} -Wno-unused-parameter -Wno-unused-function -Wno-error")
161161
else()
162-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
162+
set(DYND_CXX_FLAGS "${DYND_CXX_FLAGS} -Wno-error")
163163
endif()
164+
165+
set(CMAKE_CXX_FLAGS "${DYND_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
164166
endif()
165167

166168
include_directories(

0 commit comments

Comments
 (0)