<div>Because I want share the MSVC'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 "${origCompileFlags} /Fd\"${pdbpath}/${targetBinary}.pdb\""<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 " /Fd<TARGET_PDB>" "" temp "${CMAKE_${${targetBinary}_PCH_LANGUAGE}_COMPILE_OBJECT}")<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 " /Fd<TARGET_PDB>" "" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")</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: "D:/qpSOFT/MyDEV/tool/cmake/cmcldeps.exe" CXX ..\src\libs\languageutils\fakemetaobject.cpp "src/libs/languageutils/CMakeFiles/LanguageUtils.dir/fakemetaobject.cpp.obj.d" src\libs\languageutils\CMakeFiles\LanguageUtils.dir\fakemetaobject.cpp.obj "Note: including file: " "D:/qpSOFT/MyDEV/bin/amd64/cl.exe" 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"D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper.pdb" </b></span>/Yu"D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch" /FI"D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch" /Fp"D:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper_pch.pch" -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 '/FdD:/qpSOFT/Projects/QtCreator/a/src/qtcreator_pch_helper.pdb' with '/Fdbin\LanguageUtils.pdb'<br>..\src\libs\languageutils\fakemetaobject.cpp : error C2858: command-line option 'program database name (/Fdd:\qpsoft\projects\qtcreator\a\bin\languageutils.pdb)' inconsistent with precompiled header, which used '/Fdd:\qpsoft\projects\qtcreator\a\src\qtcreator_pch_helper.pdb'<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 "TARGET_PDB = XXX.pdb" 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'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 = "D:/qpSOFT/MyDEV/tool/cmake/cmcldeps.exe" CXX $in "$DEP_FILE" $out "Note: including file: " "D:/qpSOFT/MyDEV/bin/amd64/cl.exe" 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"><<a href="mailto:loaden@gmail.com" target="_blank">loaden@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>It'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>