set_directory_properties must be called before the directory is processed
Hi,
there is a bug/documentation update needed for set_directory_properties.
If you have a CMake project that looks like this:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.8)
add_subdirectory(sub)
sub/CMakeLists.txt:
add_executable(
sub_app
sub_source.c
)
set_directory_properties(
PROPERTIES
INCLUDE_DIRECTORIES
some_path
)
then "set_directory_properties" will have no affect, but moving it to just above the "add_executable" invocation will cause it to have the intended behaviour.
The documentation for "set_directory_properties" looks like this: https://cmake.org/cmake/help/latest/command/set_directory_properties.html
Note that the documentation for set_property(), does imply that the order that subdirectories are processed and the order that properties are added matters with this documentation:
"Scope defaults to the current directory but another directory (already processed by CMake) may be named by full or relative path."
But there is no such indication in the "set_directory_properties" documentation.