Anywhere where CMAKE_CURRENT_SOURCE_DIR is used, causes build errors when doing include(etl/CMakeLists.txt) since CMAKE_CURRENT_SOURCE_DIR will continue to use the value of the CMake file that called include(etl/CMakeLists.txt). Normally this shouldn't be a problem as you would typically use add_subdirectory anyways. However, ESP-IDF for ESP32 chips has their own build system that for some reason adds dependencies using include instead of add_subdirectory.
Proposed Solution
Regardless of the fact that add_subdirectory should typically be used, it seems that CMAKE_CURRENT_LIST_DIR more closely fits the intention behind the places that use CMAKE_CURRENT_SOURCE_DIR. I'm suggesting replacing all instances of CMAKE_CURRENT_SOURCE_DIR with CMAKE_CURRENT_LIST_DIR.
Problem
Anywhere where
CMAKE_CURRENT_SOURCE_DIR
is used, causes build errors when doinginclude(etl/CMakeLists.txt)
sinceCMAKE_CURRENT_SOURCE_DIR
will continue to use the value of the CMake file that calledinclude(etl/CMakeLists.txt)
. Normally this shouldn't be a problem as you would typically useadd_subdirectory
anyways. However, ESP-IDF for ESP32 chips has their own build system that for some reason adds dependencies usinginclude
instead ofadd_subdirectory
.Proposed Solution
Regardless of the fact that
add_subdirectory
should typically be used, it seems thatCMAKE_CURRENT_LIST_DIR
more closely fits the intention behind the places that useCMAKE_CURRENT_SOURCE_DIR
. I'm suggesting replacing all instances ofCMAKE_CURRENT_SOURCE_DIR
withCMAKE_CURRENT_LIST_DIR
.3 Files (10 instances including comments)