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

Enrique Izaguirre enrique.izaguirre at gmail.com
Mon Mar 14 16:52:08 EDT 2011


Thank you Eric. The section in the main CMakeLists.txt is as follows:

set (FILES "")
message ("Adding subdirectory host...")
include (host/CMakeLists.txt)

message ("FILES = ${FILES}")
foreach (FILE ${FILES})
    set (hostFiles ${hostFiles} host/${FILE})
endforeach (FILE)

message ("hostFiles = ${hostFiles}")

add_executable (omap ${comdrvFiles} ${hostFiles})


The hostFiles variable when displayed using the message ( ) shown above
shows the following:

hostFiles =
host/fastboot.c;host/bootimg.c;host/engine.c;host/board_configuration.c;host/bootimg.c;host/engine.c;host/om
ap_protocol.c;host/output.c;host/pheriphalboot.c;host/protocol.c;host/usb_linux.c;host/util_linux.c

Even so, only compiles host/fastboot.c, which disolays a few warnings and
then shows the error described.

In the CMakeLIsts.txt file from host/ directory, I only set the FILE
variable with the list of files contained in that directory:

set(CMAKE_INCLUDE_CURRENT_DIR ON)

message ("Entering host's CMakeLists")

# Add the sources to the host sources Sistem variable:

message ("Setting /host files, to include them in the build")
set(FILES  fastboot.c bootimg.c engine.c)
set(FILES ${FILES} board_configuration.c bootimg.c engine.c)
set(FILES ${FILES} omap_protocol.c output.c pheriphalboot.c protocol.c)
set(FILES ${FILES} usb_linux.c util_linux.c)


I am working on Windows platform, using Cygwin and doing a Cross-compilation
to Linux. I have a Toolchain file that tested before and it is working
right.
The cmake version is 2.8.3

Thanks a lot

Enrique





On Mon, Mar 14, 2011 at 2:20 PM, Eric Noulard <eric.noulard at gmail.com>wrote:

> 2011/3/14 Enrique Izaguirre <enrique.izaguirre at gmail.com>:
> > Hello friends,
> >
> > I have a problem when I try to compile several files, for some reason it
> > takes only the first of the list to build it.
> > It displays a few warnings and at the end the following error:
> >
> > 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
> >
> > Even before doing the add_executable ( ), I display first the variable
> that
> > contains the list of files to build, and it indeed has all the files to
> > compile; somehow it only compiles the first one and then leave. Running
> make
> > with the VERVOSE=1 I can see the command, and it has only the first file
> of
> > the list; so CMake is generating the command wrong.
> > Can you explain why only one file is compiled and not the entire list?
>
> Looks like some sort of typo.
> Could you give us the  CMakeLists.txt extract with the offending commands?
> At least the source file list definition and the add_executable statement.
>
> and some more info:
>
> - platform/host/compiler
> - cmake version
> - native or cross-compiling
>
>
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110314/627dfca8/attachment.htm>


More information about the CMake mailing list