Build: Move config check to after compiler setup

To allow invalid configs to depend on the compiler version. Also, add
the option for a platform check_config.cmake for platforms to specify
invalid configs.

Change-Id: If9081067e2804b329415193fa260702b0055e23e
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 681ac89..40882c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,14 @@
 project("Trusted Firmware M" VERSION ${TFM_VERSION} LANGUAGES C ASM)
 tfm_toolchain_reload_compiler()
 
+############################ Config Check ######################################
+
+include(${CMAKE_SOURCE_DIR}/config/check_config.cmake)
+
+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/check_config.cmake)
+    include(platform/ext/target/${TFM_PLATFORM}/check_config.cmake)
+endif()
+
 ################################################################################
 
 add_subdirectory(lib/ext)