VARIABLES directory property doesn't contain all the properties
I was working on a snippet to dump all vars and properties set by CMake and came across inconsistency in what VARIABLES property reports.
According to docs, it should report all properties set on the directory, but it misses at least COMPILE_OPTIONS
. Here is reproducer:
cmake_minimum_required(VERSION 3.23)
project(test)
add_compile_options("-abc")
get_directory_property(_val "COMPILE_OPTIONS")
message(STATUS "property COMPILE_OPTIONS=${_val}")
get_directory_property(_vars VARIABLES)
list(FIND _vars "COMPILE_OPTIONS" COMPILE_OPTIONS_IDX)
if (COMPILE_OPTIONS_IDX EQUAL -1)
message(FATAL_ERROR "Not found COMPILE_OPTIONS in VARIABLES, but property exists")
else()
message(STATUS "Found COMPILE_OPTIONS in VARIABLES, all good")
endif()
Edited by Maxim Ivanov