Build: Use OPTIONAL in include() instead of existence check
Use OPTIONAL in include() instead of file existence checking codes.
This can simply the codes a bit.
If OPTIONAL is present, then no error is raised if the file does not
exist.
Change-Id: Ia22e3154707312d94754e545725a3ba6095c9a13
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 3cba192..69db5a3 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -203,7 +203,4 @@
include(${CMAKE_SOURCE_DIR}/lib/ext/tf-m-tests/install.cmake)
##################### Platform-specific installation ###########################
-
-if (EXISTS ${TARGET_PLATFORM_PATH}/install.cmake)
- include(${TARGET_PLATFORM_PATH}/install.cmake)
-endif()
+include(${TARGET_PLATFORM_PATH}/install.cmake OPTIONAL)
diff --git a/config/check_config.cmake b/config/check_config.cmake
index 482236f..025dbad 100644
--- a/config/check_config.cmake
+++ b/config/check_config.cmake
@@ -120,6 +120,4 @@
###################### Platform-specific checks ################################
-if (EXISTS ${TARGET_PLATFORM_PATH}/check_config.cmake)
- include(${TARGET_PLATFORM_PATH}/check_config.cmake)
-endif()
+include(${TARGET_PLATFORM_PATH}/check_config.cmake OPTIONAL)
diff --git a/config/post_config.cmake b/config/post_config.cmake
index 6872820..f4fdece 100644
--- a/config/post_config.cmake
+++ b/config/post_config.cmake
@@ -9,9 +9,7 @@
include(config/config_base.cmake)
# Load regression configs overrided by platform
-if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
- include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
-endif()
+include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake OPTIONAL)
# Fetch tf-m-tests repo during config, if NS or regression test is required.
# Therefore tf-m-tests configs can be set with TF-M configs since their configs
diff --git a/config/set_config.cmake b/config/set_config.cmake
index 3966eb4..a87ebeb 100644
--- a/config/set_config.cmake
+++ b/config/set_config.cmake
@@ -21,14 +21,10 @@
# Load build type config, setting options not already set
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
-if(EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
- include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
-endif()
+include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake OPTIONAL)
# Load platform config, setting options not already set
-if(EXISTS ${TARGET_PLATFORM_PATH}/config.cmake)
- include(${TARGET_PLATFORM_PATH}/config.cmake)
-endif()
+include(${TARGET_PLATFORM_PATH}/config.cmake OPTIONAL)
# Parse tf-m-tests config prior to platform specific config.cmake
# Some platforms select different configuration according when regression tests