Merge branch 'bugfix/no_tests_for_unit_test_example' into 'master'

cmake: fix error in converting project variables to namespaced ones

See merge request idf/esp-idf!3887
This commit is contained in:
Angus Gratton 2018-12-05 12:58:42 +08:00
commit d50af8bd53
2 changed files with 32 additions and 14 deletions

View file

@ -279,6 +279,18 @@ function run_tests()
mv CMakeLists.bak CMakeLists.txt
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
print_status "Setting EXTRA_COMPONENT_DIRS works"
clean_build_dir
mkdir -p main/main/main # move main component contents to another directory
mv main/* main/main/main
cp CMakeLists.txt CMakeLists.bak # set EXTRA_COMPONENT_DIRS to point to the other directory
sed -i "s%cmake_minimum_required(VERSION \([0-9]\+\).\([0-9]\+\))%cmake_minimum_required(VERSION \1.\2)\nset(EXTRA_COMPONENT_DIRS main/main/main)%" CMakeLists.txt
idf.py build || failure "Build with EXTRA_COMPONENT_DIRS set failed"
mv CMakeLists.bak CMakeLists.txt # revert previous modifications
mv main/main/main/* main
rm -rf main/main
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
print_status "All tests completed"
if [ -n "${FAILURES}" ]; then
echo "Some failures were detected:"

View file

@ -18,25 +18,31 @@ endfunction()
macro(project name)
# Bridge existing documented variable names with library namespaced variables in order for old projects to work.
# Bridge existing documented variable names with library namespaced
# variables in order for old projects to work.
if(COMPONENT_DIRS)
spaces2list(COMPONENT_DIRS)
foreach(component_dir ${COMPONENT_DIRS})
get_filename_component(full_path ${component_dir} ABSOLUTE)
get_filename_component(idf_path "${IDF_PATH}/components" ABSOLUTE)
if(NOT full_path STREQUAL idf_path)
set(IDF_EXTRA_COMPONENT_DIRS "${IDF_EXTRA_COMPONENT_DIRS} ${component_dir}")
endif()
get_filename_component(component_dir ${component_dir} ABSOLUTE BASE_DIR ${CMAKE_SOURCE_DIR})
list(APPEND IDF_COMPONENT_DIRS "${component_dir}")
endforeach()
else()
if(MAIN_SRCS)
set(IDF_EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} ${CMAKE_SOURCE_DIR}/components")
else()
set(IDF_EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} \
${CMAKE_SOURCE_DIR}/components ${CMAKE_SOURCE_DIR}/main")
endif()
endif()
if(EXTRA_COMPONENT_DIRS)
spaces2list(EXTRA_COMPONENT_DIRS)
foreach(component_dir ${EXTRA_COMPONENT_DIRS})
get_filename_component(component_dir ${component_dir} ABSOLUTE BASE_DIR ${CMAKE_SOURCE_DIR})
list(APPEND IDF_EXTRA_COMPONENT_DIRS "${component_dir}")
endforeach()
endif()
list(APPEND IDF_EXTRA_COMPONENT_DIRS "${CMAKE_SOURCE_DIR}/components")
if(NOT MAIN_SRCS)
list(APPEND IDF_EXTRA_COMPONENT_DIRS "${CMAKE_SOURCE_DIR}/main")
endif()
if(COMPONENTS)