Reputation: 235
I trying to start using cmake with the simplest helloworld example, in ubuntu 12.04, cmake 2.8.7. First I tried the one from:
http://www.elpauer.org/stuff/learning_cmake.pdf
project( helloworld )
set( SRCFILES helloWorld.cpp )
add_executable( helloWorld ${SRCFILES} )
I have only a source file called "helloWorld.cpp" by the side of the 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 figure out what wrong I got all 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 again finish with:
...
-- 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, the trivial
project( helloworld )
add_executable( helloWorld helloWorld.cpp )
Fails with:
...
-- 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 trial I remove all files within compile. I just can't figure out what is missing and why the variable is set.. not set... useless?
Thank you very much for your help.
Upvotes: 4
Views: 12899
Reputation: 1210
You probably copied the same corrupted text from a webpage as I did. There must be some hidden character in the text. Re-writing the line manually solved it also for me.
Upvotes: 1