Something like this should do the trick:<br><br>add_exectuable(myExe32 A.c B.c C.c)<br>add_exectuable(myExe64 A.c B.c D.c)<br><br>set_target_properties(myExe32 PROPERTIES COMPILE_FLAGS -m32)<br>
set_target_properties(myExe32 PROPERTIES LINK_FLAGS -m32)<br>
<br>That assumes that the default setup would build 64-bit executables and you just override that default with the necessary gcc switches to force a 32-bit compile and link for the one target. You would need something more complicated to get it to work with both Visual Studio and linux/gcc but the principle is the same.<br>
<br>--<br>Glenn<br><br><br><div class="gmail_quote">On 1 July 2011 02:14, 邓尧 <span dir="ltr"><<a href="mailto:torshie@gmail.com">torshie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br><br>I'm new to CMake. My project is a little different from the projects found in the tutorials. I have to compile some of the source files into two different archs(32-bit & 64-bit). It's like the following:<br>
Given 4 source files: A.c, B.c, C.c, D.c, I need to compile a 32-bit executable with source file A.c, B.c and C.c, I also need to compile a 64-bit executable with source file A.c B.c and D.c.<br>How to write the CMake script in this situation?<br>
<br>Thanks<br><br>-Yao<br>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>