<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi John,<br><br>Thank you! This looks very nice, and uses a bit different approach than the one used in PCHSupport. <br><br>Will use this!<br><br>Johan<br><br>--- Den <b>tis 2009-12-15 skrev John Drescher <i><drescherjm@gmail.com></i></b>:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>Från: John Drescher <drescherjm@gmail.com><br>Ämne: Re: [CMake] (no subject)<br>Till: "Johan Knutzen" <knutzen_johan2@yahoo.se><br>Kopia: cmake@cmake.org<br>Datum: tisdag 15 december 2009 15.08<br><br><div class="plainMail">On Tue, Dec 15, 2009 at 4:13 AM, Johan Knutzen <<a ymailto="mailto:knutzen_johan2@yahoo.se" href="/mc/compose?to=knutzen_johan2@yahoo.se">knutzen_johan2@yahoo.se</a>> wrote:<br>><br>> Hi!<br>><br>> What is the status of scripts enabling precompiled headers for
gcc/visual studio? I've tried out PCHSupport_26 from <a href="http://www.cmake.org/Bug/view.php?id=1260" target="_blank">http://www.cmake.org/Bug/view.php?id=1260</a> but I couldn't get it to work. Does anyone have any up to date script that works with 2.8?<br>><br><br>I have not bothered in linux since I can use ccache to speed up<br>builds. In windows I use the following macro:<br><br>#########################################################################################<br><br>macro( SM_PCH_SUPPORT ProjectName )<br>if (MSVC)<br> if (USE_MSVC_PCH)<br> <br> set_source_files_properties(${ProjectName}PCH.cxx<br> PROPERTIES<br> COMPILE_FLAGS "/Yc${ProjectName}PCH.h"<br> )<br>
foreach( src_file ${${ProjectName}_SRCS} )<br> set_source_files_properties(<br> ${src_file}<br> PROPERTIES<br> COMPILE_FLAGS "/Yu${ProjectName}PCH.h"<br> )<br> endforeach( src_file ${${ProjectName}_SRCS} )<br> <br> list(APPEND ${ProjectName}_SRCS ${ProjectName}PCH.cxx)<br> list(APPEND ${ProjectName}_EXT_HDRS ${ProjectName}PCH.h)<br><br> endif(USE_MSVC_PCH)<br>endif (MSVC)<br>endmacro
(SM_PCH_SUPPORT)<br><br>#########################################################################################<br><br><br>And this requires me to have my source variable named ${ProjectName}_SRCS<br><br>And my header variable to be named ${ProjectName}_EXT_HDRS<br><br>and the following files to exist in the same folder as the CMakeLists.txt<br><br>${ProjectName}PCH.cxx ${ProjectName}PCH.h<br><br>I generally put this macro in the main project before my first<br>add_subdirectory so that all subprojects can use the macro as well.<br><br>Then to activate this in a project. I place the macro call after I<br>define the list variables.<br><br>SET( smDataManagement_SRCS<br> ./src/smData.cxx<br> ./src/smDataOperation.cxx<br> ./src/smCounterBalanceOperation.cxx<br>)<br><br>SET( smDataManagement_EXT_HDRS<br> ./Include/smData.h<br>
./Include/smDataOperation.h<br> ./Include/smCounterBalanceOperation.h<br>)<br><br>SET( smDataManagement_MOC_HDRS<br> <br>)<br><br># some .ui files<br>SET( smDataManagement_UIS<br>)<br><br># and finally an resource file<br>SET( smDataManagement_RCS<br>)<br><br>SET( smDataManagement_INT_HDRS<br><br>)<br><br>#Add precompiled header support<br>SM_PCH_SUPPORT(smDataManagement)<br><br>This works in cmake-2.6 and above.<br>John<br></div></blockquote></td></tr></table><br>
<hr size=1><table><tr><td>Ta semester! - sök efter resor hos Kelkoo. <br>Jämför pris på flygbiljetter och hotellrum: <a href="http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914051">http://www.kelkoo.se/c-169901-resor-biljetter.html</a></td></tr></table>