Hello friends, 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.
The problem is that CMake somehow is generating the compile command, and assembling it wrongly. Is there any way to overcome this issue? Thanks Best Regards Enrique On Wed, Mar 2, 2011 at 10:51 AM, Enrique Izaguirre < [email protected]> wrote: > Thank you Michael, > > This is the output: > > > /usr/bin/cmake.exe -H/home/x0148488/myprjflash > -B/home/x0148488/myprjflash/cmake_build --check-build-system > CMakeFiles/Makefile.cmake 0 > /usr/bin/cmake.exe -E cmake_progress_start > /home/x0148488/myprjflash/cmake_build/CMakeFiles > /home/x0148488/myprjflash/cmake_build/CMakeFiles/progress.marks > make -f CMakeFiles/Makefile2 all > make[1]: Entering directory `/home/x0148488/myprjflash/cmake_build' > make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/depend > make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build' > cd /home/x0148488/myprjflash/cmake_build && /usr/bin/cmake.exe > -Ecmake_depends "Unix Makefiles" /home/x0148488/myprjflash > /home/x0148488/myprjflash /home/x0148488/myprjflash/cmake_build > /home/x0148488/myprjflash/cmake_build > /home/x0148488/myprjflash/cmake_build/CMakeFiles/myprj.dir/DependInfo.cmake > --color= > make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build' > make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/build > make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build' > /usr/bin/cmake.exe -E cmake_progress_report > /home/x0148488/myprjflash/cmake_build/CMakeFiles 1 > [ 12%] Building CXX object CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o > /bin/g++-linux -D_BSD_SOURCE -DWIN32 -D_DEBUG -D_CONSOLE > -D_CRT_SECURE_NO_WARNINGS -DNO_ZIP -I/home/x0148488/myprjflash > /cmake_build -I/home/x0148488/myprjflash > -I/home/x0148488/myprjflash/common/inc -I/home/x0148488/myprjflash/../inc > -I/home/ > x0148488/myprjflash/target/src/boot -I"C:/Program /Files/Microsoft > /SDKs/Windows/v6.0A/Include" -I/usr/include/w32api - > Wall -pedantic -Werror -o CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o > -c /home/x0148488/myprjflash/comdriver/src/StdAf > x.cpp > > i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple > compilations > make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1 > make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build' > > make[1]: *** [CMakeFiles/myprj.dir/all] Error 2 > make[1]: Leaving directory `/home/x0148488/myprjflash/cmake_build' > make: *** [all] Error 2 > > > Thanks > > Enrique > > > > > > On Wed, Mar 2, 2011 at 10:37 AM, Michael Wild <[email protected]> wrote: > >> On 03/02/2011 05:33 PM, Enrique Izaguirre wrote: >> > Hello friends, >> > >> > I have another problem with my build. I run Cmake and complete the >> building >> > and production of a Makefile. >> > But when I run make I get the following result: >> > >> > i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple >> > compilations >> > make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1 >> > make[1]: *** [CMakeFiles/myprj.dir/all] Error 2 >> > make: *** [all] Error 2 >> > >> > >> > What I'm doing in the CMakeLists.txt is to get all the programs from one >> > subdirectory and put them in variable comdrvFiles, which has everything >> from >> > that subdirectory: >> > >> > comdrvFiles = >> > >> comdriver/src/StdAfx.cpp;comdriver/src/ComDriver.cpp;comdriver/src/PortEnumerator.cpp;comdriver/src/serial >> > driver.cpp;comdriver/src/usbdriver.cpp >> > >> > and then collect all the programs from another subdirectory in variable >> > hostFiles: >> > >> > hostFiles = host/fastboot.c;host/bootimg.c;host/engine.c >> > >> > >> > once that I have all the programs collected in those variables I do the >> > following: >> > >> > add_executable (myprj ${comdrvFiles} ${hostFiles}) >> > >> > to create an executable named myprj >> > >> > I don't have any program in the main directory, only the main >> CMakeLists.txt >> > and in main directory is where I collect everything and try to produce >> an >> > executable. Is there something missing? How can I produce an executable? >> > >> > Thanks in advance >> > >> > BR >> > >> > Enrique >> >> Can you show the output of "make VERBOSE=1"? >> >> Michael >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://www.cmake.org/mailman/listinfo/cmake >> > >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
