[CMake] Compiling multiple files, only takes the first one

Andreas Pakulat apaku at gmx.de
Mon Mar 14 17:14:18 EDT 2011


On 14.03.11 15:04:54, Enrique Izaguirre wrote:
> Hi Alex,
> 
> This is the whole output from the make. I can only see warnings:
> 
> /bin/gcc-linux  -DCOMDRIVER_EXPORTS -DBUILD_FIX_TMP -DFIX_WIN32 -DNO_ZIP
> -D_DEBUG -D_CONSOLE -I/home/x0148488/omapflash/cmake_build
> -I/home/x0148488/omapflash -I/home/x0148488/omapflash/comdriver/inc
> -I/home/x0148488/omapflash/target/src/boot
> -I/home/x0148488/omapflash/../../../usr/include/LinuxAPI
> -I/home/x0148488/omapflash/../../../usr/include/OtherLinuxFiles
> -I/home/x0148488/omapflash/common/inc   -Wall -Werror -o
> CMakeFiles/omap.dir/host/fastboot.c.o   -c
> /home/x0148488/omapflash/host/fastboot.c
> 
> /home/x0148488/omapflash/host/fastboot.c:125: warning: missing braces around
> initializer
> /home/x0148488/omapflash/host/fastboot.c:125: warning: (near initialization
> for `parity_names[5]')
> /home/x0148488/omapflash/host/fastboot.c: In function `find_named_value':
> /home/x0148488/omapflash/host/fastboot.c:206: warning: implicit declaration
> of function `stricmp'
> /home/x0148488/omapflash/host/fastboot.c: In function `open_device':
> /home/x0148488/omapflash/host/fastboot.c:397: warning: unused variable
> `timeremaining'
> /home/x0148488/omapflash/host/fastboot.c: In function
> `offset_and_chip_name':
> /home/x0148488/omapflash/host/fastboot.c:749: warning: unused variable
> `addr'
> /home/x0148488/omapflash/host/fastboot.c: In function `arg':
> /home/x0148488/omapflash/host/fastboot.c:1143: warning: unused variable
> `mem_addr'
> /home/x0148488/omapflash/host/fastboot.c:1201: warning: implicit declaration
> of function `_snprintf'
> /home/x0148488/omapflash/host/fastboot.c: At top level:
> /home/x0148488/omapflash/host/fastboot.c:76: warning: `wipe_data' defined
> but not used
> make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1
> make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build'
> make[1]: *** [CMakeFiles/omap.dir/all] Error 2
> make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build'
> make: *** [all] Error 2
> 
> Also the compiler command generated only shows the first file. What could be
> the problem?

As Alexander said, thats normal. CMake generates a separate rule for
each file to compile it. Then once all object files are created it'll
link them together to the executable you specified. And thats not your
problem:

> Do I have to fix the warnings?

Yes, because you're passing -Werror to the compiler it errors out on the
first warning it sees. So either you fix the warnings or you remove that
flag from your cmake or toolchain files.

Andreas



More information about the CMake mailing list