系统:
Linux anon-S 3.19.0-31-generic #36~14.04.1-Ubuntu SMP Thu Oct 8 10:21:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
CMake版本:
anon@anon-S:~/$ cmake --version
cmake version 3.2.2
主要的CMakeLists.txt文件:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(${PROJECT_SOURCE_DIR}/test)
但是
anon@anon-S:/home/anon/project/build$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anon/project/
构建文件已经写入到:/home/anon/project/
而不是 /home/anon/project/build/
我在我的Debian jessie上使用cmake 3.4.1没有这个问题:
anon@anon-S:/home/anon/project/build$ cmake ..
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is GNU 5.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.11")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anon/project/build/
src
和test
子目录中的CMakeLists.txt
文件包含什么内容? - Tsyvarev/home/anon/project
目录下(导致源码和构建结果混杂)意外运行过CMake? - Angew is no longer proud of SO