Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not unconditionally set CMAKE_C_FLAGS_RELEASE #408

Open
danfe opened this issue Jan 9, 2025 · 0 comments
Open

Do not unconditionally set CMAKE_C_FLAGS_RELEASE #408

danfe opened this issue Jan 9, 2025 · 0 comments

Comments

@danfe
Copy link

danfe commented Jan 9, 2025

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant