EXCLUDE_FROM_ALL does not disable install if set as directory property (with CMP0082 NEW)
$ cat >CMakeLists.txt <<END
cmake_minimum_required(VERSION 3.14)
project(ProjectName)
add_subdirectory(subdir)
END
$ mkdir subdir
$ cat >subdir/CMakeLists.txt <<END
set_directory_properties(PROPERTY EXCLUDE_FROM_ALL ON)
add_library(mylibrary mysrc.cpp)
install(TARGETS mylibrary)
END
$ touch subdir/mysrc.cpp
$ cmake . && make install
-- Configuring done
-- Generating done
-- Build files have been written to: <...>
Install the project...
-- Install configuration: ""
CMake Error at subdir/cmake_install.cmake:41 (file):
file INSTALL cannot find
"<...>/subdir/libmylibrary.a": No such file or directory.
Call Stack (most recent call first):
cmake_install.cmake:42 (include)
make: *** [install] Error 1
Expected: CMake does not try to install subdir/libmylibrary.a, since EXCLUDE_FROM_ALL was set on its directory scope.
This worked prior to 3.14, and works with CMP0082 set to OLD.
This works if EXCLUDE_FROM_ALL is passed as an option to add_subdirectory() instead of setting it as a directory property after the subdirectory is added.
As a temporary workaround we are setting CMP0082 to OLD; we are contemplating passing EXCLUDE_FROM_ALL to add_subdirectory() but are wary of other effects this could have.