Hello friends,<br><br>As far as I have been investigating this problem, seems that GNU compilers have a problem when combining -c flag with multiple files and -o flag to generate an executable.<br><br>The problem is that CMake somehow is generating the compile command, and assembling it wrongly. Is there any way to overcome this issue?<br>
<br>Thanks<br><br>Best Regards<br><br>Enrique<br><br><br><br><div class="gmail_quote">On Wed, Mar 2, 2011 at 10:51 AM, Enrique Izaguirre <span dir="ltr">&lt;<a href="mailto:enrique.izaguirre@gmail.com">enrique.izaguirre@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thank you Michael,<br><br>This is the output:<br><br><br>/usr/bin/cmake.exe -H/home/x0148488/myprjflash -B/home/x0148488/myprjflash/cmake_build --check-build-system CMakeFiles/Makefile.cmake 0<br>
/usr/bin/cmake.exe -E cmake_progress_start /home/x0148488/myprjflash/cmake_build/CMakeFiles /home/x0148488/myprjflash/cmake_build/CMakeFiles/progress.marks<br>
make -f CMakeFiles/Makefile2 all<br>make[1]: Entering directory `/home/x0148488/myprjflash/cmake_build&#39;<br>make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/depend<br>make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build&#39;<br>

cd /home/x0148488/myprjflash/cmake_build &amp;&amp; /usr/bin/cmake.exe -Ecmake_depends &quot;Unix Makefiles&quot; /home/x0148488/myprjflash<br> /home/x0148488/myprjflash /home/x0148488/myprjflash/cmake_build /home/x0148488/myprjflash/cmake_build /home/x0148488/myprjflash/cmake_build/CMakeFiles/myprj.dir/DependInfo.cmake --color=<br>

make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build&#39;<br>make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/build<br>make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build&#39;<br>/usr/bin/cmake.exe -E cmake_progress_report /home/x0148488/myprjflash/cmake_build/CMakeFiles 1<br>

[ 12%] Building CXX object CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o<br>/bin/g++-linux   -D_BSD_SOURCE -DWIN32 -D_DEBUG -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS -DNO_ZIP -I/home/x0148488/myprjflash<br>/cmake_build -I/home/x0148488/myprjflash -I/home/x0148488/myprjflash/common/inc -I/home/x0148488/myprjflash/../inc -I/home/<br>

x0148488/myprjflash/target/src/boot -I&quot;C:/Program /Files/Microsoft /SDKs/Windows/v6.0A/Include&quot; -I/usr/include/w32api   -<br>Wall -pedantic -Werror -o CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o -c /home/x0148488/myprjflash/comdriver/src/StdAf<br>

x.cpp<div class="im"><br>i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple compilations<br>make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1<br></div>make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build&#39;<div class="im">
<br>
make[1]: *** [CMakeFiles/myprj.dir/all] Error 2<br></div>make[1]: Leaving directory `/home/x0148488/myprjflash/cmake_build&#39;<br>make: *** [all] Error 2<br><br><br>Thanks<br><font color="#888888"><br>Enrique</font><div>
<div></div><div class="h5"><br><br><br><br><br><div class="gmail_quote">
On Wed, Mar 2, 2011 at 10:37 AM, Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div><div>On 03/02/2011 05:33 PM, Enrique Izaguirre wrote:<br>
&gt; Hello friends,<br>
&gt;<br>
&gt; I have another problem with my build. I run Cmake and complete the building<br>
&gt; and production of a Makefile.<br>
&gt; But when I run make I get the following result:<br>
&gt;<br>
&gt; i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple<br>
&gt; compilations<br>
&gt; make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1<br>
&gt; make[1]: *** [CMakeFiles/myprj.dir/all] Error 2<br>
&gt; make: *** [all] Error 2<br>
&gt;<br>
&gt;<br>
&gt; What I&#39;m doing in the CMakeLists.txt is to get all the programs from one<br>
&gt; subdirectory and put them in variable comdrvFiles, which has everything from<br>
&gt; that subdirectory:<br>
&gt;<br>
&gt; comdrvFiles =<br>
&gt; comdriver/src/StdAfx.cpp;comdriver/src/ComDriver.cpp;comdriver/src/PortEnumerator.cpp;comdriver/src/serial<br>
&gt; driver.cpp;comdriver/src/usbdriver.cpp<br>
&gt;<br>
&gt; and then collect all the programs from another subdirectory in variable<br>
&gt; hostFiles:<br>
&gt;<br>
&gt; hostFiles = host/fastboot.c;host/bootimg.c;host/engine.c<br>
&gt;<br>
&gt;<br>
&gt; once that I have all the programs collected in those variables I do the<br>
&gt; following:<br>
&gt;<br>
&gt; add_executable (myprj ${comdrvFiles} ${hostFiles})<br>
&gt;<br>
&gt; to create an executable named myprj<br>
&gt;<br>
&gt; I don&#39;t have any program in the main directory, only the main CMakeLists.txt<br>
&gt; and in main directory is where I collect everything and try to produce an<br>
&gt; executable. Is there something missing? How can I produce an executable?<br>
&gt;<br>
&gt; Thanks in advance<br>
&gt;<br>
&gt; BR<br>
&gt;<br>
&gt; Enrique<br>
<br>
</div></div>Can you show the output of &quot;make VERBOSE=1&quot;?<br>
<br>
Michael<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>
</div></div></blockquote></div><br>