【问题标题】:Ubuntu cmake errors after update更新后的 Ubuntu cmake 错误
【发布时间】:2018-09-05 18:38:49
【问题描述】:

将 cmake 更新到 3.12.1 版后出现错误

CMake Error at /usr/local/share/cmake-3.12/Modules/CMakeDetermineSystem.cmake:174 (file):
  file attempted to write a file:
  /home/wow/TrinityCore/CMakeFiles/CMakeOutput.log into a source directory.
Call Stack (most recent call first):
  CMakeLists.txt:19 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

make 已安装

GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

g++ 也是。 Ubuntu 版本 14.04.5

有什么帮助或想法吗?

谢谢!

【问题讨论】:

  • 您是否删除了构建目录并再次运行 cmake?
  • 是的,但同样的错误
  • 第一个错误 - “文件试图写入文件:” - 看起来很可疑。在project() 调用之前显示您的代码。
  • @Tsyvarev 我在哪里可以找到这个?我以前从未使用过 cmake……这是 TrinityCore Projekt
  • 我的水晶球说您设置了CMAKE_DISABLE_IN_SOURCE_BUILD 和/或CMAKE_DISABLE_SOURCE_CHANGES,然后尝试进行源内构建。也就是说,从项目的根目录中,你刚刚写了cmake .。创建一个build 子目录并在其中运行cmake。对于一个体面的项目结构(它仍然是一个 WIP),请参阅github.com/vector-of-bool/vector-of-bool.github.io/blob/master/…

标签: linux ubuntu cmake trinitycore


【解决方案1】:

正如在 cmets 中已经指出的那样,消息

file attempted to write a file ... into a source directory

是项目CMakeLists.txt 中设置的CMAKE_DISABLE_SOURCE_CHANGES 变量的结果。此设置激活检查,CMake 项目不会在源目录下创建任何文件。 (有关此变量设置的更准确描述,请参见 that answer)。

一般情况下,设置CMAKE_DISABLE_SOURCE_CHANGES变量伴随着设置CMAKE_DISABLE_IN_SOURCE_BUILD变量,字面意思:

项目不应在源代码中构建。

解决方案是在 build directory 中构建项目 out-of-source,该目录与 source one 不同。

例如那样:

cd <project-dir>
mkdir build
cd build
cmake ..

【讨论】:

    猜你喜欢
    • 2014-12-18
    • 2014-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-06
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多