Fix _FORTIFY_SOURCE redefinition warning on musl/Alpine. (0.40.7)
- Moved _FORTIFY_SOURCE=3 from target_compile_definitions to target_compile_options with a preceding -U_FORTIFY_SOURCE via the SHELL: prefix to prevent redefinition warnings on musl/Alpine where the compiler already defines it via built-in macros. - The SHELL: prefix ensures both flags stay together and in the correct order on the compile command line. - Updated CHANGELOG.md entry for 0.40.7 with the fix.
This commit is contained in:
parent
72f7812630
commit
e51a77123e
2 changed files with 3 additions and 4 deletions
|
|
@ -62,9 +62,8 @@ add_executable(zynk zynk.c)
|
|||
if(BUILD_STRICT)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
|
||||
target_compile_options(zynk PRIVATE -Wall -Wextra -Wformat=2
|
||||
-Wstrict-prototypes -pedantic -fstack-protector-strong)
|
||||
target_compile_definitions(zynk PRIVATE
|
||||
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>:_FORTIFY_SOURCE=3>)
|
||||
-Wstrict-prototypes -pedantic -fstack-protector-strong
|
||||
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>:SHELL:-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3>)
|
||||
target_link_options(zynk PRIVATE -Wl,-z,relro,-z,now -Wl,-z,noexecstack)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue