Build: add build type support
Refactor cmake files to support setting the "build type" following CMake
idioms. A "build type" is a set of compiler flags controlling code
optimization and debug information generation. For more information on
the supported types and their meaning please refer to the documentation.
This change extends build type support to external components too. The
build type of each component can be independently controlled using
command line settings. For details about the supported types and
settings, please refer to the cmake file of the external component and
the documentation of the external project.
This change tries to be backwards compatible and selects the default
build type to be "Debug". This may change in the future.
Change-Id: Ic041140bb8d4aaf0f07be9c4cac0638c03996eb5
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
diff --git a/components/service/spm_test/spm_test.cmake b/components/service/spm_test/spm_test.cmake
index 484892a..f4add98 100644
--- a/components/service/spm_test/spm_test.cmake
+++ b/components/service/spm_test/spm_test.cmake
@@ -47,33 +47,18 @@
${TS_ROOT}/components/service/spm_test
)
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(spm-test${SP_NUMBER} PRIVATE
+ -std=c99
+ )
+endif()
+
#-------------------------------------------------------------------------------
# Deployment specific source files
#-------------------------------------------------------------------------------
target_sources(spm-test${SP_NUMBER} PRIVATE
${TS_ROOT}/components/service/spm_test/sp.c
)
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_compile_options(spm-test${SP_NUMBER} PRIVATE
- -fdiagnostics-show-option
- -gdwarf-2
- -mstrict-align
- -O0
- $<$<COMPILE_LANGUAGE:C>:-std=c99>
- $<$<COMPILE_LANGUAGE:CXX>:-fno-use-cxa-atexit>
- )
-
- # Options for GCC that control linking
- target_link_options(spm-test${SP_NUMBER} PRIVATE
- -zmax-page-size=4096
- )
- # Options directly for LD, these are not understood by GCC
- target_link_options(spm-test${SP_NUMBER} PRIVATE
- -Wl,--as-needed
- -Wl,--sort-section=alignment
- # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
- )
-endif()
compiler_generate_stripped_elf(TARGET spm-test${SP_NUMBER} NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)