In regards to this topic *in my opinion* linking directory structure/level to CMake CFLAGS is not a good design (on the part of CMake)... again *in my opinion*.  <br><br>I would prefer there was project level (and ability to inherit project level settings from another project using the project() where project could use project(myProject INHERIT myOtherProject) and add_subdirectory level inheritance with the addition concept of namespaces.<br>
<br>Namespaces, which do not exist, would allow use of add_subdirectory with third party source and could prepend CMAKE_C_FLAGS with the project name if add_subdirectory allowed the use of a project name specification such as:  add_subdirectory( directory PROJECT myProjectName).   Then CMAKE_C_FLAGS would become myProjectName.CMAKE_C_FLAGS and any use of CACHE STRING &quot;&quot; FORCE in the added subdirectory would change myProjectName.CMAKE_C_FLAGS and not the global (argh) CMAKE_C_FLAGS.<br>
<br>With these changes to CMake a programmer could add more easily 3rdParty packages with add_subdirectory and not have CMAKE_C_FLAGS get blasted away by each 3rd party package.  <br><br>For anyone interested in why I want/desire this please see &quot;Build Only What You Need In Third Party Packages&quot;:<br>
<a href="http://www.mail-archive.com/cmake@cmake.org/msg25703.html">http://www.mail-archive.com/cmake@cmake.org/msg25703.html</a><br><br>if your having difficulty with global CFLAGS and subdir project inheritance.... I feel your pain.