This command adds compile options to all source files in the current directory and below.
This is not what I observe. Example:
% find . ! -type d
./foo.cpp
./CMakeLists.txt
./bar/CMakeLists.txt
./bar/bar.cpp
% echo ----- | cat CMakeLists.txt - bar/CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(foo LANGUAGES CXX)
add_executable(foo foo.cpp)
add_subdirectory("bar")
-----
add_compile_options("-Wbitfield-width")
target_sources(foo PRIVATE bar.cpp)
% cmake -B build -G Ninja
...
-Wbitfield-width is NOT in the compile flags for bar.cpp. If I understood your 2nd paragraph comment correctly, it should have been added to any source files in bar/.
I believe that the docs are stating that add_compile_options changes the DIRECTORY properties, but (!) those properties only affect newly defined targets at that directly and below.