<div>Because I want share the MSVC&#39;s PCH files, so I have to set the compile PDB name:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">    get_filename_component(pdbpath ${${targetBinary}_PCH_BINARY_FILE} PATH)<br>

    get_target_property(targetCompileFlags ${targetSelf} COMPILE_FLAGS)<br>    if (targetCompileFlags)<br>        set(origCompileFlags ${targetCompileFlags})<br>    endif()<br>    set_target_properties(${targetSelf} PROPERTIES<br>

        COMPILE_FLAGS &quot;${origCompileFlags} /Fd\&quot;${pdbpath}/${targetBinary}.pdb\&quot;&quot;<br>    ) <br></blockquote><div><br>For NMake Makefiles generator, it works after change:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

    string(REGEX REPLACE &quot; /Fd&lt;TARGET_PDB&gt;&quot; &quot;&quot; temp &quot;${CMAKE_${${targetBinary}_PCH_LANGUAGE}_COMPILE_OBJECT}&quot;)<br>    set(CMAKE_${${targetBinary}_PCH_LANGUAGE}_COMPILE_OBJECT ${temp} PARENT_SCOPE)<br>

</blockquote> <br>It mean I can change the PDB file name using a hacking way:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<b>string(REGEX REPLACE &quot; /Fd&lt;TARGET_PDB&gt;&quot; &quot;&quot; CMAKE_CXX_COMPILE_OBJECT &quot;${CMAKE_CXX_COMPILE_OBJECT}&quot;)</b><br></blockquote>But it does not work with Ninja generator.<br><br></div></div>

<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">FAILED: &quot;D:/qpSOFT/MyDEV/tool/cmake/cmcldeps.exe&quot; CXX ..\src\libs\languageutils\fakemetaobject.cpp &quot;src/libs/languageutils/CMakeFiles/LanguageUtils.dir/fakemetaobject.cpp.obj.d&quot; src\libs\languageutils\CMakeFiles\LanguageUtils.dir\fakemetaobject.cpp.obj &quot;Note: including file: &quot; &quot;D:/qpSOFT/MyDEV/bin/amd64/cl.exe&quot; D:\qpSOFT\MyDEV\bin\amd64\cl.exe   /nologo /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -ID:\qpSOFT\MyDEV\sdk\qt\lib\amd64\..\..\include\ -ID:\qpSOFT\MyDEV\sdk\qt\lib\amd64\..\..\include\QtCore -ID:\qpSOFT\MyDEV\sdk\qt\lib\amd64\..\..\mkspecs\amd64\win32-msvc2010     <span style="color:rgb(255,0,0)"><b>/Fd&quot;D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper.pdb&quot; </b></span>/Yu&quot;D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch&quot; /FI&quot;D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch&quot; /Fp&quot;D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch&quot;  -DLanguageUtils_EXPORTS -DUNICODE -D_CRT_SECURE_NO_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DQT_CREATOR -DLANGUAGEUTILS_BUILD_DIR -DQT_CORE_LIB /TP /Fosrc\libs\languageutils\CMakeFiles\LanguageUtils.dir\fakemetaobject.cpp.obj <span style="color:rgb(51,51,255)"><b>/Fdbin\LanguageUtils.pdb</b></span> -c ..\src\libs\languageutils\fakemetaobject.cpp<br>


cl : Command line warning D9025 : overriding &#39;/FdD:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper.pdb&#39; with &#39;/Fdbin\LanguageUtils.pdb&#39;<br>..\src\libs\languageutils\fakemetaobject.cpp : error C2858: command-line option &#39;program database name (/Fdd:\qpsoft\projects\qtcreator\a\bin\languageutils.pdb)&#39; inconsistent with precompiled header, which used &#39;/Fdd:\qpsoft\projects\qtcreator\a\src\qtcreator_pch_helper.pdb&#39;<br>


..\src\libs\languageutils\fakemetaobject.cpp : error C2859: d:\qpsoft\projects\qtcreator\a\bin\languageutils.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.<br>


<br>ninja: build stopped: subcommand failed.<br></blockquote><br><div>Could you please give me any tips?<br>
I look into the build.ninja file, and see there are many &quot;TARGET_PDB = XXX.pdb&quot; lines.<br>The PDB file is hard code  to target name.<br><br>So, the question may be changed to: How to change the PDB file name of Ninja generator?<br>

<br>I read the rules.ninja file too, there seems exist a rules for compilation.<br>But I don&#39;t know how to change the rules.<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

#############################################
<br># Rule for compiling CXX files.
<br> <br>rule CXX_COMPILER
<br>  depfile = $DEP_FILE
<br>  command = &quot;D:/qpSOFT/MyDEV/tool/cmake/cmcldeps.exe&quot; CXX $in &quot;$DEP_FILE&quot; $out &quot;Note: including file: &quot; &quot;D:/qpSOFT/MyDEV/bin/amd64/cl.exe&quot; D:\qpSOFT\MyDEV\bin\amd64\cl.exe   /nologo $FLAGS  $DEFINES /TP /Fo$out <span style="color:rgb(255,0,0)"><b>/Fd$TARGET_PDB</b></span> -c $in
<br>  description = Building CXX object $out<br></blockquote><br>
Thanks for any comments / helps.<br></div><b><br></b><div class="gmail_quote">2012/9/22 Loaden <span dir="ltr">&lt;<a href="mailto:loaden@gmail.com" target="_blank">loaden@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>It&#39;s works great on Linux, but has some issue for MSVC about share the precompiled header files.<br>NMake works well with that.</div></blockquote></div><br><br clear="all"><br>-- <br><div>Best Regards</div>

<div>Yuchen</div><br>