Cmake a very simple typing error

I am trying to start using cmake with the simplest helloworld example, in ubuntu 12.04, cmake 2.8.7. First I tried one of:

http://www.elpauer.org/stuff/learning_cmake.pdf

project( helloworld ) set( SRCFILES helloWorld.cpp ) add_executable( helloWorld ${SRCFILES} ) 

I have only the source file called helloWorld.cpp, next to CMakeLists.txt. I created a directory called "configure", went inside and called "cmake ..". I get the following:

 -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at CMakeLists.txt:3 (add_executable): add_executable called with incorrect number of arguments -- Configuring incomplete, errors occurred! 

Trying to find out what happened, I received the following changes:

 project( helloworld ) set( SRCFILES helloWorld.cpp ) message ( "src ${SRCFILES}" ) set(x helloWorld.cpp) set(y 2) message(${x}${y}) message(${x}${y}) message(${SRCFILES}) add_executable( helloWorld ${SRCFILES} ) add_executable( helloWorld ${x} ) add_executable( helloWorld helloWorld.cpp ) 

The results end again:

 ... -- Detecting CXX compiler ABI info - done src helloWorld.cpp2 helloWorld.cpp2 CMake Error at CMakeLists.txt:8 (message): message called with incorrect number of arguments CMake Error at CMakeLists.txt:10 (add_executable): add_executable called with incorrect number of arguments CMake Error at CMakeLists.txt:11 (add_executable): add_executable called with incorrect number of arguments CMake Error at CMakeLists.txt:12 (add_executable): add_executable called with incorrect number of arguments -- Configuring incomplete, errors occurred! 

Finally trivial

 project( helloworld ) add_executable( helloWorld helloWorld.cpp ) 

Failure:

 ... -- Detecting CXX compiler ABI info - done CMake Error at CMakeLists.txt:2 (add_executable): add_executable called with incorrect number of arguments -- Configuring incomplete, errors occurred! 

Before each test, I delete all the files in the compilation. I just can't figure out what is missing and why the variable is set. Not installed ... useless?

Many thanks for your help.

+4
source share
1 answer

You probably copied the same corrupted text from a webpage as I did. The text should be hidden. Recording the line manually solved it for me as well.

0
source

All Articles