【发布时间】:2016-08-02 18:53:38
【问题描述】:
系统:
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的内容是什么? -
您是否曾经(不小心)在
/home/anon/project中运行 CMake(导致源内构建)?