libdeflate
libdeflate copied to clipboard
Do not unconditionally set `CMAKE_C_FLAGS_RELEASE`
Most GNU/Linux and *BSD distributions build their packages with certain default compilation flags, e.g. on FreeBSD, our framework sets -DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS} -DNDEBUG" and CFLAGS already includes -O2 plus some other useful options, or it could be set by the user to her liking which we should respect. May I suggest the following small patch to CMakeLists.txt:
# Set common C compiler flags for all targets (the library and the programs).
-set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+if(NOT CMAKE_C_FLAGS_RELEASE)
+ set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+endif()
set(CMAKE_C_STANDARD 99)
set by the user to her liking
Two wrongs don't make a right.
I was hoping to see this addressed somehow in the latest 1.25 release, but alas. Anything in particular you don't like about the suggested patch, Eric?