diff options
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 6 | ||||
-rw-r--r-- | Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 53cb030..6195d1f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8760,7 +8760,11 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile( cmGeneratedFileStream fout(filename); fout.SetCopyIfDifferent(true); - fout << "#include <" << headerFilename << ">\n"; + // IWYU pragma: associated allows include what you use to + // consider the headerFile as part of the entire language + // unit within include-what-you-use and as a result allows + // one to get IWYU advice for headers :) + fout << "#include <" << headerFilename << "> // IWYU pragma: associated\n"; fout.close(); return filename; diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake index 100f482..4d5508d 100644 --- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake @@ -9,7 +9,7 @@ function(check_file target filename) if(filename MATCHES "^(.*)(\\.[a-z]+)$") set(header_filename "${CMAKE_MATCH_1}") endif() - set(expected_contents "#include <${header_filename}>\n") + set(expected_contents "#include <${header_filename}> // IWYU pragma: associated\n") file(READ "${full_filename}" actual_contents) if(NOT actual_contents STREQUAL expected_contents) |