cmake: fix error in converting project variables to namespaced ones

Closes https://github.com/espressif/esp-idf/issues/2764
This commit is contained in:
Renz Christian Bagaporo 2018-12-04 22:04:00 +08:00
parent 3bc970c5f4
commit 0d5660fbde

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)