-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: Add a custom build type with the Fedora rpm compilation options.
Configuring a cmake build with the -DCMAKE_BUILD_TYPE=Fedora argument will add all the compile/link arguments used by the Fedora build system to the already specified arguments, except for the one that adds rpm build notes to the metadata of a linked executable. This build type should allow for easy testing of whether a compile by the fedora build team will fail.
- Loading branch information
1 parent
09b0acb
commit f2b1aa4
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (C) 2024 David Hampton | ||
# | ||
# See the file LICENSE_FSF for licensing information. | ||
# | ||
if(NOT CMAKE_C_COMPILER_ID STREQUAL GNU) | ||
message( | ||
FATAL_ERROR "The Fedora build type requires the use of the gcc compiler.") | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS_FEDORA | ||
"-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" | ||
) | ||
set(CMAKE_CXX_FLAGS_FEDORA | ||
"-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" | ||
) | ||
set(CMAKE_EXE_LINKER_FLAGS_FEDORA | ||
"-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1" | ||
) | ||
set(CMAKE_MODULE_LINKER_FLAGS_FEDORA "${CMAKE_EXE_LINKER_FLAGS_FEDORA}") | ||
set(CMAKE_SHARED_LINKER_FLAGS_FEDORA "${CMAKE_EXE_LINKER_FLAGS_FEDORA}") |