<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>> Has anyone had any luck with precompiled
headers on visual studio 2005?<BR>> <BR>> For Visual Studio 6, i added
additional parameters to each compiled <BR>> file. I then told one specific
file to build the precompiled headers. <BR>> This worked in vs6, but in 2005
the ide must have the actual projects <BR>> setup for precompiled headers.
This "hack" won't work on 2005.<BR>> <BR>> I know there have been requests
to add precompiled headers, but I was <BR>> wondering if anyone has written a
custom add-in to cmake to do this. If <BR>> not, I am going to have to write
one.<BR>> </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I think the best way to achieve this is to write
your own generator but I'm not a master of CMake so maybe there is a simplier
way.</FONT></DIV>
<DIV><FONT face=Arial size=2>Anyway I will describe how I added precompiled
header in case it can help you, or someone else.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The basic idea is to add properties to the files
and retrieve them is a custom made generator. </FONT></DIV>
<DIV><FONT face=Arial size=2>To do this I have a module file which contains a
big FOREACH loop. </FONT><FONT face=Arial size=2>It loops on the source list and
add the properties to each file when it encounters one.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The list of files : </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>LIST(APPEND GLOBAL_FILE_DESC</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> "Source
Files"</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> "Source
Files/Module"<BR> @CREATE_PCH
"source/dummy.cpp"<BR>
"dummy.h"<BR> @USE_PCH
"source/dummy2.cpp"<BR>
"dummy2.h"<BR> @NO_PCH
"source/dummy3.cpp"<BR>
"dummy3.h"</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> "Source
Files/Docs"<BR> @EXCLUDE
"dummy.dox"</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> "Resource
Files"<BR>
"resources/dummy.rc"</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This loop adds properties and sourcegroup. The sub
loops allow to add properties or file groups from our master CMakeLists.txt
directly.</FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>FOREACH(SOURCE_DESCRIPTION
${GLOBAL_FILE_DESC})</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> # look for the nature of
the entry<BR> <BR> IF(${SOURCE_DESCRIPTION}
MATCHES "@.*")<BR>
<BR> # this is a
property<BR> #
------------------<BR>
FOREACH(FILE_PROPERTY
${FILE_PROPERTIES})<BR>
IF(${SOURCE_DESCRIPTION} MATCHES
"@(${FILE_PROPERTY})$")<BR>
# add this property to the current
properties<BR>
LIST(APPEND CUR_PROPERTIES ${${FILE_PROPERTY}_PROPERTY}
${${FILE_PROPERTY}_VALUE})<BR>
ENDIF(${SOURCE_DESCRIPTION} MATCHES
"@(${FILE_PROPERTY})$")<BR>
ENDFOREACH(FILE_PROPERTY
${FILE_PROPERTIES})<BR>
<BR> ELSE(${SOURCE_DESCRIPTION} MATCHES
"@.*")<BR> IF(${SOURCE_DESCRIPTION}
MATCHES ".*[.].*$")</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2> # this
is a file<BR>
#
--------------<BR>
FOREACH(FILE_GROUP
${FILE_GROUPS})<BR>
IF(${SOURCE_DESCRIPTION} MATCHES
".*[.](${REGISTRED_${FILE_GROUP}_EXT})")<BR>
# add the file to its
group<BR>
LIST(APPEND ${FILE_GROUP}
${SOURCE_DESCRIPTION})<BR>
IF(CUR_PROPERTIES)<BR>
# add current properties to the
file<BR>
SET_SOURCE_FILES_PROPERTIES(${SOURCE_DESCRIPTION} PROPERTIES
${CUR_PROPERTIES})<BR>
SET(CUR_PROPERTIES
"")<BR>
ENDIF(CUR_PROPERTIES)<BR>
ENDIF(${SOURCE_DESCRIPTION} MATCHES
".*[.](${REGISTRED_${FILE_GROUP}_EXT})")<BR>
ENDFOREACH(FILE_GROUP
${FILE_GROUPS})<BR>
# add the file to the current folder
list<BR>
LIST(APPEND CUR_FOLDER_LIST ${SOURCE_DESCRIPTION})
<BR>
<BR> ELSE(${SOURCE_DESCRIPTION}
MATCHES ".*[.].*$")<BR>
<BR> # this is
a source
folder<BR> #
-----------------------<BR>
IF(CUR_FOLDER)<BR>
# we meet a valid source
folder<BR>
SOURCE_GROUP(${CUR_FOLDER} FILES
${CUR_FOLDER_LIST})<BR>
SET(CUR_FOLDER_LIST
"")<BR>
ENDIF(CUR_FOLDER)<BR>
SET(CUR_FOLDER
${SOURCE_DESCRIPTION})
<BR>
<BR> ENDIF(${SOURCE_DESCRIPTION}
MATCHES ".*[.].*$")<BR> ENDIF(${SOURCE_DESCRIPTION} MATCHES
"@.*") <BR>ENDFOREACH(SOURCE_DESCRIPTION
${GLOBAL_FILE_DESC})</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2># create the last source
folder<BR>IF(CUR_FOLDER)<BR> SOURCE_GROUP(${CUR_FOLDER} FILES
${CUR_FOLDER_LIST})<BR>ENDIF(CUR_FOLDER)</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2># merge all file groups into one
group<BR>FOREACH(FILE_GROUP ${FILE_GROUPS})<BR>
IF(${FILE_GROUP})<BR> LIST(APPEND
TARGET_FILES ${${FILE_GROUP}})<BR>
ENDIF(${FILE_GROUP})<BR>ENDFOREACH(FILE_GROUP ${FILE_GROUPS})</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>After this, you create your own generator where you
retrieve the properties and write them to the project files.</FONT></DIV>
<DIV><FONT face=Arial size=2>Hope that will help you a bit.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Sylvain</FONT></DIV></BODY></HTML>