<div class="gmail_quote">On Tue, Mar 3, 2009 at 3:06 PM, Steven Wilson <span dir="ltr">&lt;<a href="mailto:steven.wesley.wilson@gmail.com">steven.wesley.wilson@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As a new member of the list, I just wanted to say thanks for providing this forum as a place to get answers about cmake!<div><br></div><div>First, the problem:   I have a software system composed of a number of source files in C.   These files have an alternate file extension .bc.   In order to compile these files, the build system first needs to pass them through two preprocessors; 1. The C preprocessor and 2. a homegrown preprocessor that handles a private C language extension and converts occurrences of that language extension to standard C.   Finally the preprocessed source is handed to the C compiler.    My initial port of this build system used the following kind of construct:</div>

<div><br></div><div>macro(process_bc_files INPUT_FILE)</div><div><br></div><blockquote style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;">add_custom_command(OUTPUT ${INPUT_FILE}.c<br>
</blockquote><blockquote style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;"><blockquote style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;">COMMAND preprocessor1 ${INPUT_FILE} &gt; tmpfile<br>

COMMAND preprocessor2 tmpfile &gt; ${INPUT_FILE}.c<br></blockquote></blockquote><blockquote style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;">)</blockquote><div><br></div><div><br></div>
<div>endmacro(process_bc_files)</div><div><br></div><div>process_bc_file(/path/to/main.bc)</div><div><br></div><div>add_executable(Foo main.bc.c)</div><div><br></div><div>Now this construct works and the build functions correctly, but I have noticed a problem that I need to have corrected.   When I use the Xcode generator on my project I get a nice Xcode project except that the source files listed for executable Foo are the processed files (*.bc.c) not the original .bc files.  This state of course makes sense because the .bc.c files are used in the add_executable line, but it makes the Xcode project file incorrect because developers will not edit the .bc.c files but the originals.</div>

<div><br></div><div>The question:  Does a way to do something like the following exist?</div><div><br></div><div>add_executable(Foo main.bc)</div><div><br></div><div>Ie can I create some rules that act like the add_custom_command so that the add_executable refers to the processed output while the Xcode project refers to the source file?</div>
</blockquote><div><br>You might be able to use the HEADER_FILE_ONLY property of set_source_files_properties() to get it to show up in the project, but simply not have it compiled.  I know this works in Visual Studio (not sure about Xcode).<br>
</div></div><br>-- <br>Philip Lowman<br>