CMake error: ROOT should be built as an out of source build

CMake error: ROOT should be built as an out of source build

我正在尝试构建项目 ROOT。有一个使用 cmake ../root 构建的命令。每当我尝试 运行 这个命令时,它都会给我这个错误:

Harshits-Air:root harshitprasad$ cmake ../root
-- Found a Mac OS X System 10.13
-- Found a 64bit system
-- Found LLVM compiler collection
-- ROOT Platform: macosx
-- ROOT Architecture: macosx64
-- Build Type: RelWithDebInfo
-- Compiler Flags:  -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wshadow -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG
CMake Error at cmake/modules/RootNewMacros.cmake:1041 (message):
  ROOT should be built as an out of source build, to keep the source
  directory clean.  Please create a extra build directory and run the command
  'cmake <path_to_source_dir>' in this newly created directory.  You have
  also to delete the directory CMakeFiles and the file CMakeCache.txt in the
  source directory.  Otherwise cmake will complain even if you run it from an
  out-of-source directory.
Call Stack (most recent call first):
  CMakeLists.txt:107 (ROOT_CHECK_OUT_OF_SOURCE_BUILD)

我不明白这个错误是什么意思?如果有人可以帮助我解决这个问题,那就太好了。谢谢!

错误消息只是告诉您创建一个额外的构建文件夹,例如build 在 ROOT 项目文件夹 root 旁边,切换到此目录并从那里调用 cmake ../root

TLDR; 只需从根文件夹开始调用以下序列:

cd ..
mkdir build
cd build
cmake ../root