diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 146886906..549ff28c8 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -222,10 +222,16 @@ void cmSourceFile::CheckExtension() if(std::find(hdrExts.begin(), hdrExts.end(), this->Extension) == hdrExts.end()) { - this->SetProperty("HEADER_FILE_ONLY", "0"); + // This is not a known header file extension. Mark it as not a + // header unless the user has already explicitly set the property. + if(!this->GetProperty("HEADER_FILE_ONLY")) + { + this->SetProperty("HEADER_FILE_ONLY", "0"); + } } else { + // This is a known header file extension. The source cannot be compiled. this->SetProperty("HEADER_FILE_ONLY", "1"); }