[CMake] Make append_if semantics similar to those used in LLVM