Build: Adjust configuration order
Reorder the configuration steps, to provide more intuitive
configuration. Invert the current order, and remove the use of FORCE to
create a configuration additively instead of using overriding. Allows
cmake command-line variables to override all other options as is
expected.
Change-Id: I64730b7db230cdaf2f86f1d27d882dc9111607be
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 71a2497..75986f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,14 @@
############################ CONFIGURATION #####################################
+# Some compiler flags depend on the CPU / platform config. This include should
+# be run before the toolchain file so the compiler can be configured properly.
+if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
+ Message(FATAL_ERROR "Unsupported TFM_PLATFORM ${TFM_PLATFORM}")
+else()
+ include(platform/ext/target/${TFM_PLATFORM}/preload.cmake)
+endif()
+
include(config/set_config.cmake)
if(NOT ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND
@@ -28,14 +36,6 @@
############################### Compiler configuration #########################
-# Some compiler flags depend on the CPU / platform config. This include should
-# be run before the toolchain file so the compiler can be configured properly.
-if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
- Message(FATAL_ERROR "Unsupported TFM_PLATFORM ${TFM_PLATFORM}")
-else()
- include(platform/ext/target/${TFM_PLATFORM}/preload.cmake)
-endif()
-
#Legacy compat option - load CMAKE_TOOLCHAIN_FILE as a TFM_TOOLCHAIN_FILE
if (CMAKE_TOOLCHAIN_FILE)
message(DEPRECATION "SETTING CMAKE_TOOLCHAIN_FILE is deprecated. It has been replaced with TFM_TOOLCHAIN_FILE.")