[CMake] Problem with add_executable ( )

Enrique Izaguirre enrique.izaguirre at gmail.com
Thu Feb 17 15:28:21 EST 2011


Thank you Andreas,

Yes, it is empty, but I tried now creating FILES this way before the
foreach:

set (FILES "")

and still got the same result.

Is this way OK to create an empty variable?

Thanks

Enrique

On Thu, Feb 17, 2011 at 2:02 PM, Andreas Pakulat <apaku at gmx.de> wrote:

> On 17.02.11 12:39:36, Enrique Izaguirre wrote:
> > Hello friends,
> >
> > I have a problem when running cmake command, the add_executable ( ) is
> > giving me an error which I cannot see what is the problem. I have in my
> main
> > CMakeLists.txt files the following section:
> > ======================================
> > include (host/CMakeLists.txt)
> >
> > foreach (FILE ${FILES})
> >     set (hostFiles ${hostFiles} host/${FILE})
> > endforeach (FILE)
> >
> > add_executable (mainprog ${hostFiles})
> > ======================================
> >
> >
> > After running the cmake command I got the following error:
> >
> > Adding subdirectory host...
> > Entering host's CMakeLists
> > CMake Error at CMakeLists.txt:82 (add_executable):
> >   add_executable called with incorrect number of arguments
> >
> > My understanding is that add_executable can take from 2 arguments, is
> this
> > correct?
> >
> > As shown above, I have in host/  subdirectory a CMakeLists.txt file with
> the
> > following:
> >
> > set(CMAKE_INCLUDE_CURRENT_DIR ON)
> > message ("Entering host's CMakeLists")
> >
> >
> > and that's it.
> >
> > What could be the problem?
>
> You do not supply enough arguments to add_executable. Check what the
> value of ${hostFiles} is by using message(). I bet its empty given that
> you don't create FILES variable anywhere.
>
> Andreas
>
> --
> You've been leading a dog's life.  Stay off the furniture.
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110217/cda2a61f/attachment.htm>


More information about the CMake mailing list