mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 11:03:11 +00:00
Merge branch 'fix/cmake_quotations' into 'master'
Build & config: Quote variable references in conditional expressions Closes IDFGH-17506 See merge request espressif/esp-idf!47675
This commit is contained in:
@@ -77,22 +77,22 @@ function(__parse_and_store_version_arg)
|
||||
cmake_parse_arguments(PROJECT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# If the VERSION keyword exists but no version string is provided then raise a warning
|
||||
if((NOT PROJECT_VERSION
|
||||
OR PROJECT_VERSION STREQUAL "NOTFOUND")
|
||||
AND NOT PROJECT_VERSION STREQUAL "0")
|
||||
if(("${PROJECT_VERSION}" STREQUAL ""
|
||||
OR "${PROJECT_VERSION}" STREQUAL "NOTFOUND")
|
||||
AND NOT "${PROJECT_VERSION}" STREQUAL "0")
|
||||
message(STATUS "VERSION keyword not followed by a value or was followed by a value that expanded to nothing.")
|
||||
# Default the version to 1 in this case
|
||||
set(project_ver 1)
|
||||
else()
|
||||
# Check if version is valid. cmake allows the version to be in the format <major>[.<minor>[.<patch>[.<tweak>]]]]
|
||||
string(REGEX MATCH "^([0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)?)?$" version_valid ${PROJECT_VERSION})
|
||||
if(NOT version_valid AND NOT PROJECT_VERSION STREQUAL "0")
|
||||
string(REGEX MATCH "^([0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)?)?$" version_valid "${PROJECT_VERSION}")
|
||||
if(NOT version_valid AND NOT "${PROJECT_VERSION}" STREQUAL "0")
|
||||
message(SEND_ERROR "Version \"${PROJECT_VERSION}\" format invalid.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Split the version string into major, minor, patch, and tweak components
|
||||
string(REPLACE "." ";" version_components ${PROJECT_VERSION})
|
||||
string(REPLACE "." ";" version_components "${PROJECT_VERSION}")
|
||||
list(GET version_components 0 PROJECT_VERSION_MAJOR)
|
||||
list(LENGTH version_components version_length)
|
||||
if(version_length GREATER 1)
|
||||
@@ -733,7 +733,7 @@ macro(project project_name)
|
||||
# Check if version information was passed to project() via the VERSION argument
|
||||
set(version_keyword_present FALSE)
|
||||
foreach(arg ${ARGN})
|
||||
if(${arg} STREQUAL "VERSION")
|
||||
if("${arg}" STREQUAL "VERSION")
|
||||
set(version_keyword_present TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -94,7 +94,7 @@ macro(__target_init config_file)
|
||||
|
||||
# Check if selected target is consistent with CMake cache
|
||||
if(DEFINED CACHE{IDF_TARGET})
|
||||
if(NOT $CACHE{IDF_TARGET} STREQUAL ${env_idf_target})
|
||||
if(NOT $CACHE{IDF_TARGET} STREQUAL "${env_idf_target}")
|
||||
message(FATAL_ERROR " IDF_TARGET '$CACHE{IDF_TARGET}' in CMake"
|
||||
" cache does not match currently selected IDF_TARGET '${env_idf_target}'."
|
||||
" To change the target, clear the build directory and sdkconfig file,"
|
||||
@@ -105,7 +105,7 @@ macro(__target_init config_file)
|
||||
# Check if selected target is consistent with sdkconfig
|
||||
__target_from_config("${config_file}" sdkconfig_target where)
|
||||
if(sdkconfig_target)
|
||||
if(NOT ${sdkconfig_target} STREQUAL ${env_idf_target})
|
||||
if(NOT "${sdkconfig_target}" STREQUAL "${env_idf_target}")
|
||||
message(FATAL_ERROR " Target '${sdkconfig_target}' in sdkconfig '${where}'"
|
||||
" does not match currently selected IDF_TARGET '${IDF_TARGET}'."
|
||||
" To change the target, clear the build directory and sdkconfig file,"
|
||||
@@ -143,7 +143,7 @@ macro(__target_set_toolchain)
|
||||
" the build directory and sdkconfig file, and build the project again.")
|
||||
endif()
|
||||
|
||||
if(${env_idf_toolchain} STREQUAL "clang")
|
||||
if("${env_idf_toolchain}" STREQUAL "clang")
|
||||
# TODO IDF-14338: remove the line below since it will be set in toolchain.cmake
|
||||
set(IDF_TOOLCHAIN ${env_idf_toolchain} CACHE STRING "IDF Build Toolchain Type")
|
||||
set(toolchain_filename "toolchain-clang-${IDF_TARGET}.cmake")
|
||||
|
||||
Reference in New Issue
Block a user