Skip to content

Commit

Permalink
Make x86 flags conditional
Browse files Browse the repository at this point in the history
Fix DMTF#337.

Signed-off-by: Steven Bellock <[email protected]>
  • Loading branch information
steven-bellock committed Mar 6, 2024
1 parent 93baf2a commit 0fb7abc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,17 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")

if(TOOLCHAIN STREQUAL "GCC")
SET(CMAKE_C_COMPILER gcc)
ADD_COMPILE_OPTIONS(-std=c99 -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -maccumulate-outgoing-args -mno-red-zone -Wno-address -fpie -fno-asynchronous-unwind-tables -flto -DUSING_LTO -Wno-maybe-uninitialized -Wno-uninitialized -Wno-builtin-declaration-mismatch -Wno-nonnull-compare)
ADD_COMPILE_OPTIONS(-std=c99 -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -Wno-address -fpie -fno-asynchronous-unwind-tables -flto -DUSING_LTO -Wno-maybe-uninitialized -Wno-uninitialized -Wno-builtin-declaration-mismatch -Wno-nonnull-compare)
if(GCOV STREQUAL "ON")
ADD_COMPILE_OPTIONS(--coverage -fprofile-arcs -ftest-coverage)
endif()
if (ARCH STREQUAL "x64")
ADD_COMPILE_OPTIONS(-mno-red-zone)
endif()
if (ARCH STREQUAL "x64" OR "ia32")
ADD_COMPILE_OPTIONS(-maccumulate-outgoing-args)
endif()

SET(MBEDTLS_FLAGS "")
SET(OPENSSL_FLAGS -include base.h -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable)
SET(CMOCKA_FLAGS -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong)
Expand Down Expand Up @@ -315,10 +322,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")

SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group")


elseif(TOOLCHAIN STREQUAL "CLANG")
SET(CMAKE_C_COMPILER clang)
ADD_COMPILE_OPTIONS(-g -fshort-wchar -fno-strict-aliasing -Wall -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -mno-red-zone -Wno-address -fpie -fno-asynchronous-unwind-tables -flto -DUSING_LTO)
if (ARCH STREQUAL "x64")
ADD_COMPILE_OPTIONS(-mno-red-zone)
endif()

SET(MBEDTLS_FLAGS "")
SET(OPENSSL_FLAGS -include base.h -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable)
SET(CMOCKA_FLAGS -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong)
Expand Down

0 comments on commit 0fb7abc

Please sign in to comment.