Merge branch 'bugfix/cmake_case_insenstive_filesystem' into 'master'
cmake: Account for IDF_PATH case mismatches on case insensitive filesystems See merge request espressif/esp-idf!6137
This commit is contained in:
commit
01a8e566b8
|
@ -1,19 +1,24 @@
|
||||||
get_property(__idf_env_set GLOBAL PROPERTY __IDF_ENV_SET)
|
get_property(__idf_env_set GLOBAL PROPERTY __IDF_ENV_SET)
|
||||||
if(NOT __idf_env_set)
|
if(NOT __idf_env_set)
|
||||||
# Infer an IDF_PATH relative to the tools/cmake directory
|
# Infer an IDF_PATH relative to the tools/cmake directory
|
||||||
get_filename_component(_idf_path "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
|
get_filename_component(_idf_path "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH)
|
||||||
file(TO_CMAKE_PATH "${_idf_path}" _idf_path)
|
file(TO_CMAKE_PATH "${_idf_path}" _idf_path)
|
||||||
|
|
||||||
# Get the path set in environment
|
# Get the path set in environment
|
||||||
set(idf_path $ENV{IDF_PATH})
|
set(idf_path $ENV{IDF_PATH})
|
||||||
file(TO_CMAKE_PATH "${idf_path}" idf_path)
|
|
||||||
|
|
||||||
# Environment IDF_PATH should match the inferred IDF_PATH. If not, warn the user.
|
# Environment IDF_PATH should match the inferred IDF_PATH. If not, warn the user.
|
||||||
|
# (Note: REALPATH is needed in both above steps to account for case on case
|
||||||
|
# insensitive filesystems, or relative paths)
|
||||||
if(idf_path)
|
if(idf_path)
|
||||||
|
get_filename_component(idf_path "${idf_path}" REALPATH)
|
||||||
|
file(TO_CMAKE_PATH "${idf_path}" idf_path)
|
||||||
|
|
||||||
if(NOT idf_path STREQUAL _idf_path)
|
if(NOT idf_path STREQUAL _idf_path)
|
||||||
message(WARNING "IDF_PATH environment variable is different from inferred IDF_PATH.
|
message(WARNING "IDF_PATH environment variable is different from inferred IDF_PATH.
|
||||||
Check if your project's top-level CMakeLists.txt includes the right
|
Check if your project's top-level CMakeLists.txt includes the right
|
||||||
CMake files. Environment IDF_PATH will be used for the build.")
|
CMake files. Environment IDF_PATH will be used for the build:
|
||||||
|
${idf_path}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "IDF_PATH environment variable not found. Setting IDF_PATH to '${_idf_path}'.")
|
message(WARNING "IDF_PATH environment variable not found. Setting IDF_PATH to '${_idf_path}'.")
|
||||||
|
@ -43,4 +48,4 @@ if(NOT __idf_env_set)
|
||||||
__build_init("${idf_path}")
|
__build_init("${idf_path}")
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY __IDF_ENV_SET 1)
|
set_property(GLOBAL PROPERTY __IDF_ENV_SET 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue