Commit 5b216d1a by Carlos Martín Nieto

CMake: don't overwrite the user's CFLAGS

If either CFLAGS is defined or the user passes -DCMAKE_C_FLAGS to
cmake, the variable already contains flags. Don't overwrite them, but
append them to our settings.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent dcd62cb2
...@@ -57,7 +57,7 @@ ENDIF () ...@@ -57,7 +57,7 @@ ENDIF ()
# Platform specific compilation flags # Platform specific compilation flags
IF (MSVC) IF (MSVC)
SET(CMAKE_C_FLAGS "/W4 /nologo /Zi") SET(CMAKE_C_FLAGS "/W4 /nologo /Zi ${CMAKE_C_FLAGS}")
IF (STDCALL) IF (STDCALL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz")
ENDIF () ENDIF ()
...@@ -65,7 +65,7 @@ IF (MSVC) ...@@ -65,7 +65,7 @@ IF (MSVC)
SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd") SET(CMAKE_C_FLAGS_DEBUG "/Od /DEBUG /MTd")
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2") SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
ELSE () ELSE ()
SET(CMAKE_C_FLAGS "-O2 -g -Wall -Wextra -Wstrict-aliasing=2 -Wstrict-prototypes -Wmissing-prototypes") SET(CMAKE_C_FLAGS "-O2 -g -Wall -Wextra -Wstrict-aliasing=2 -Wstrict-prototypes -Wmissing-prototypes ${CMAKE_C_FLAGS}")
IF (NOT MINGW) # MinGW always does PIC and complains if we tell it to IF (NOT MINGW) # MinGW always does PIC and complains if we tell it to
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF () ENDIF ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment