[CMake] Problem with add_executable ( )

Andreas Pakulat apaku at gmx.de
Thu Feb 17 15:02:11 EST 2011


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.


More information about the CMake mailing list