【发布时间】:2014-09-22 03:26:54
【问题描述】:
我正在尝试从 http://www.cmake.org/cmake/help/cmake_tutorial.html 学习 CMake,但在运行简单文件 tutorial.cpp 的第一步本身遇到了麻烦。
问题是当我在 CMakeLists.txt 文件中有这个命令时
add_executable(Tutorial tutorial.cpp)
它构建得很好。
但是,当我将其更改为
add_executable(Tutorial tutorial.cxx)
它给出了以下错误
-- 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
我的目录结构是这样的:
.
├── 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)
【问题讨论】: