Skip to content

Commit

Permalink
Fix #24 #355, Add compile flag abstractions
Browse files Browse the repository at this point in the history
Adds STRICT_NO_WARNINGS and OMIT_DEPRECATED
prep options for CI and as example build
  • Loading branch information
skliper committed Jan 7, 2020
1 parent 2b27dfc commit 69a7930
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmake/sample_defs/targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,28 @@ 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)

# Cache related environment variables
# NOTE - requires distclean and re-"make prep" to change
set(STRICT_NO_WARNINGS $ENV{STRICT_NO_WARNINGS} CACHE STRING "Enable strict warnings and Werror")
set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deperecated elements")

# Helper definition to abstract strict compiler flags and
# treat warnings as errors. Settings are not appropriate for every build
# environment/target, targeted for CI and as an example set.
if (STRICT_NO_WARNINGS)
message (STATUS "STRICT_NO_WARNINGS=true: Enforcing strict warnings and Werror")
add_definitions(-Wall -Werror -std=c99 -D_XOPEN_SOURCE=600 -pedantic -Wstrict-prototypes -Wcast-align -Wwrite-strings)
else()
message (STATUS "STRICT_NO_WARNINGS=false: Not enforced")
endif (STRICT_NO_WARNINGS)

# 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)


0 comments on commit 69a7930

Please sign in to comment.