cmake: consider sdkconfig defaults value from environment

pull/4345/head
Renz Christian Bagaporo 2019-10-28 15:32:08 +08:00
rodzic b0bb53de06
commit 42d4f39a9a
1 zmienionych plików z 17 dodań i 11 usunięć

Wyświetl plik

@ -313,22 +313,28 @@ macro(project project_name)
# PROJECT_NAME is taken from the passed name from project() call # PROJECT_NAME is taken from the passed name from project() call
# PROJECT_DIR is set to the current directory # PROJECT_DIR is set to the current directory
# PROJECT_VER is from the version text or git revision of the current repo # PROJECT_VER is from the version text or git revision of the current repo
if(SDKCONFIG_DEFAULTS) set(_sdkconfig_defaults "$ENV{SDKCONFIG_DEFAULTS}")
foreach(sdkconfig_default ${SDKCONFIG_DEFAULTS})
get_filename_component(sdkconfig_default "${sdkconfig_default}" ABSOLUTE) if(NOT _sdkconfig_defaults)
if(NOT EXISTS "${sdkconfig_default}")
message(FATAL_ERROR "SDKCONFIG_DEFAULTS '${sdkconfig_default}' does not exist.")
endif()
list(APPEND sdkconfig_defaults ${sdkconfig_default})
endforeach()
else()
if(EXISTS "${CMAKE_SOURCE_DIR}/sdkconfig.defaults") if(EXISTS "${CMAKE_SOURCE_DIR}/sdkconfig.defaults")
set(sdkconfig_defaults "${CMAKE_SOURCE_DIR}/sdkconfig.defaults") set(_sdkconfig_defaults "${CMAKE_SOURCE_DIR}/sdkconfig.defaults")
else() else()
set(sdkconfig_defaults "") set(_sdkconfig_defaults "")
endif() endif()
endif() endif()
if(SDKCONFIG_DEFAULTS)
set(_sdkconfig_defaults "${SDKCONFIG_DEFAULTS}")
endif()
foreach(sdkconfig_default ${_sdkconfig_defaults})
get_filename_component(sdkconfig_default "${sdkconfig_default}" ABSOLUTE)
if(NOT EXISTS "${sdkconfig_default}")
message(FATAL_ERROR "SDKCONFIG_DEFAULTS '${sdkconfig_default}' does not exist.")
endif()
list(APPEND sdkconfig_defaults ${sdkconfig_default})
endforeach()
if(SDKCONFIG) if(SDKCONFIG)
get_filename_component(sdkconfig "${SDKCONFIG}" ABSOLUTE) get_filename_component(sdkconfig "${SDKCONFIG}" ABSOLUTE)
else() else()