From b5c369a9165f139e8b4838f9e618be9516ccdd9f Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 8 Jan 2020 16:01:45 -0500 Subject: [PATCH] Fix #355: Add global scope option to omit deprecated items Adds a "global_build_options.cmake" file akin to the existing arch_build/mission_build option files. Include an example of this file that optionally does add_definitions() to omit the deprected elements for build testing. --- CMakeLists.txt | 6 +++++ cmake/sample_defs/global_build_options.cmake | 25 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 cmake/sample_defs/global_build_options.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b859fee3a..66fe338b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,12 @@ include(${MISSION_DEFS}/targets.cmake) # Scan the list of targets and organize by target system type. read_targetconfig() +# Include global-scope build customization +# Note if this feature is used it should only set basic options +# that have wide support (e.g. add_definitions). It should not +# set anything target or machine specific. +include("${MISSION_DEFS}/global_build_options.cmake" OPTIONAL) + # Additionally the target mission might require additional # custom build steps or override some routines. In particular # some architectures might need some special installation steps diff --git a/cmake/sample_defs/global_build_options.cmake b/cmake/sample_defs/global_build_options.cmake new file mode 100644 index 000000000..2f49e0dda --- /dev/null +++ b/cmake/sample_defs/global_build_options.cmake @@ -0,0 +1,25 @@ +# +# Example global_build_options.cmake +# ---------------------------------- +# +# This may set global definitions that apply to ALL targets in ALL scopes, +# including FSW code that is cross-compiled for a target as well as code +# built for the development host itself (native). +# +# As such, it should only invoke basic commands that have wide applicability, +# such as "add_definitions()" for macro definitions that should be set +# globally. It should not include any compiler-specific options that might +# change between compiler vendors or target processor families. +# + +# If the OMIT_DEPRECATED flag is specified, then define the respective macros +# that omit the deprecated features from the build. This is conditional in this +# example for CI purposes, so it can be tested both ways. Most projects would +# likely set this only one way. +set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deprecated elements") +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)