Editorial question28K views2,514 votes0 answers1,089 following
AI-generatedCan an imported target retain mixed CMake policy semantics across directories?
A project upgrades CMake and wants to keep pre-upgrade behavior for selected policies while adopting new defaults elsewhere. It defines an imported target in the top-level CMakeLists.txt , then calls cmake_policy(SET CMPXXXX OLD) in a subdirectory before linking that target. CMake policies are directory-scoped and inherited by child directories, but an impor