Reputation: 404
I'm trying to learn CMake from http://www.cmake.org/cmake/help/cmake_tutorial.html and running into trouble with the first step itself of running a simple file tutorial.cpp.
The issue is that when I have this command in my CMakeLists.txt file
add_executable(Tutorial tutorial.cpp)
it builds fine.
However, when I change it to
add_executable(Tutorial tutorial.cxx)
It gives the following error
-- Configuring done
CMake Error at src/CMakeLists.txt:6 (add_executable):
Cannot find source file:
tutorial.cxx
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
-- Build files have been written to: /home/vaisagh/workspace/Test/build
My directory structure is like this:
.
├── build
├── CMakeLists.txt
└── src
├── CMakeLists.txt
└── tutorial.cpp
2 directories, 3 files
CMakeLists.txt
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 2.8.11)
#Name your project here
project(Tutorial)
add_subdirectory(src)
src/CMakeLists.txt
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 2.8.11)
add_executable(Tutorial tutorial.cxx)
Upvotes: 4
Views: 4314
Reputation: 1839
Tried extensions .c .C...
Indicates that CMake tried to search for tutorial.cxx.c
, tutorial.cxx.C
, etc.
The source filename given to add_executable
must match the actual filename on disc.
tutorial.cpp
to tutorial.cxx
-or-add_executable(Tutorial tutorial.cxx)
to add_executable(Tutorial tutorial.cpp)
Upvotes: 4