From 28c6d80058102ca09b98aa107ec5e1d9b0ff5f81 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Tue, 7 Jan 2020 16:17:44 -0500 Subject: [PATCH] Fix #24 #355, Add compile flag abstractions Adds STRICT_NO_WARNINGS and OMIT_DEPRECATED prep options for CI and as example build --- cmake/sample_defs/targets.cmake | 18 ++++++++++++++++++ cmake/sample_defs/toolchain-cpu1.cmake | 2 ++ 2 files changed, 20 insertions(+) diff --git a/cmake/sample_defs/targets.cmake b/cmake/sample_defs/targets.cmake index 03d72f454..f6be4e037 100644 --- a/cmake/sample_defs/targets.cmake +++ b/cmake/sample_defs/targets.cmake @@ -98,3 +98,21 @@ SET(TGT1_FILELIST cfe_es_startup.scr) #SET(TGT3_APPLIST sample_app ci_lab to_lab sch_lab) #SET(TGT3_FILELIST cfe_es_startup.scr) +# Set host strict warnings, gets applied to all host compiled elements +# Note target strict warnings are defined in associated toolchain file +SET(HOST_STRICT_WARNINGS "-Wall -Werror -std=c99 -D_XOPEN_SOURCE=600 -pedantic -Wstrict-prototypes -Wcast-align -Wwrite-strings") + +# Cache related environment variables +# NOTE - requires distclean and re-"make prep" to change +set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deperecated elements") + +# Helper definition to abstract omitting deprecated elements, +# allows for one setting in CI and used by projects +if (OMIT_DEPRECATED) + message (STATUS "OMIT_DEPRECATED=true: Not including deprecated elements in build") + add_definitions(-DCFE_OMIT_DEPRECATED_6_6 -DOSAL_OMIT_DEPRECATED) +else() + message (STATUS "OMIT_DEPRECATED=false: Deprecated elements included in build") +endif (OMIT_DEPRECATED) + + diff --git a/cmake/sample_defs/toolchain-cpu1.cmake b/cmake/sample_defs/toolchain-cpu1.cmake index 27a05d454..386f25fdd 100644 --- a/cmake/sample_defs/toolchain-cpu1.cmake +++ b/cmake/sample_defs/toolchain-cpu1.cmake @@ -23,3 +23,5 @@ SET(CFE_SYSTEM_PSPNAME "pc-linux") SET(OSAL_SYSTEM_BSPNAME "pc-linux") SET(OSAL_SYSTEM_OSTYPE "posix") +# Define target strict warnings applied to all cross compiled code +SET(TARGET_STRICT_WARNINGS "-Wall -Werror -std=c99 -D_XOPEN_SOURCE=600 -pedantic -Wstrict-prototypes -Wcast-align -Wwrite-strings")