Skip to content

Commit a495677

Browse files
authored
cppcheck.vcxproj: do not use precompiled header for externals sources (#8177)
this fixes the conflict between functions with the same name in Cppcheck and simplecpp
1 parent dad374c commit a495677

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

lib/cppcheck.vcxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818
</ProjectConfiguration>
1919
</ItemGroup>
2020
<ItemGroup Label="SourceFiles">
21-
<ClCompile Include="..\externals\simplecpp\simplecpp.cpp" />
22-
<ClCompile Include="..\externals\tinyxml2\tinyxml2.cpp" />
21+
<ClCompile Include="..\externals\simplecpp\simplecpp.cpp">
22+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
23+
<ForcedIncludeFiles></ForcedIncludeFiles>
24+
</ClCompile>
25+
<ClCompile Include="..\externals\tinyxml2\tinyxml2.cpp">
26+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
27+
<ForcedIncludeFiles></ForcedIncludeFiles>
28+
</ClCompile>
2329
<ClCompile Include="valueflow.cpp" />
2430
<ClCompile Include="tokenize.cpp" />
2531
<ClCompile Include="symboldatabase.cpp" />

tools/dmake/dmake.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int write_vcxproj(const std::string &proj_name, const std::function<void(
250250
return EXIT_SUCCESS;
251251
}
252252

253-
enum ClType : std::uint8_t { Compile, Include, Precompile };
253+
enum ClType : std::uint8_t { Compile, Include, Precompile, NoPch };
254254

255255
static std::string make_vcxproj_cl_entry(const std::string& file, ClType type)
256256
{
@@ -271,6 +271,18 @@ static std::string make_vcxproj_cl_entry(const std::string& file, ClType type)
271271
outstr += " </ClCompile>\r\n";
272272
return outstr;
273273
}
274+
if (type == NoPch) {
275+
outstr += R"( <ClCompile Include=")";
276+
outstr += file;
277+
outstr += R"(">)";
278+
outstr += "\r\n";
279+
outstr += R"( <PrecompiledHeader>NotUsing</PrecompiledHeader>)";
280+
outstr += "\r\n";
281+
outstr += R"( <ForcedIncludeFiles></ForcedIncludeFiles>)";
282+
outstr += "\r\n";
283+
outstr += " </ClCompile>\r\n";
284+
return outstr;
285+
}
274286
outstr += " <";
275287
outstr += (type == Compile) ? "ClCompile" : "ClInclude";
276288
outstr += R"( Include=")";
@@ -542,8 +554,8 @@ int main(int argc, char **argv)
542554
});
543555

544556
write_vcxproj("lib/cppcheck.vcxproj", [&](std::string &outstr){
545-
outstr += make_vcxproj_cl_entry(R"(..\externals\simplecpp\simplecpp.cpp)", Compile);
546-
outstr += make_vcxproj_cl_entry(R"(..\externals\tinyxml2\tinyxml2.cpp)", Compile);
557+
outstr += make_vcxproj_cl_entry(R"(..\externals\simplecpp\simplecpp.cpp)", NoPch);
558+
outstr += make_vcxproj_cl_entry(R"(..\externals\tinyxml2\tinyxml2.cpp)", NoPch);
547559

548560
for (const std::string &libfile: libfiles_prio) {
549561
const std::string l = libfile.substr(4);

0 commit comments

Comments
 (0)