我想使用 CMake 为非 C 项目生成 makefile。我不需要 C 编译器来构建我的项目。事实上,我的主机上没有安装C编译器。
我的CMakeLists.txt
样子:
cmake_minimum_required (VERSION 2.6)
project (the_thing.html)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/cmake-pandocology")
INCLUDE(pandocology)
add_document(
TARGET the_thing
OUTPUT_FILE the_thing.html
SOURCES the_thing.md
)
Run Code Online (Sandbox Code Playgroud)
当我在 Windows 机器上运行 cmake 时:
$ mkdir dict && cd dist
$ cmake .. -G"Unix Makefiles"
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also ".../dist/CMakeFiles/CMakeOutput.log".
See also ".../dist/CMakeFiles/CMakeError.log".
Run Code Online (Sandbox Code Playgroud)
这两个日志文件没有提供额外的线索。如何修复该项目以忽略 C(和 C++)编译器的缺失?
你需要明确地说没有语言。
project("the_thing.html"
LANGUAGES
NONE
)
Run Code Online (Sandbox Code Playgroud)
这是来自我的一个项目,但它使用现代 CMake(最低版本是 2.6)。上面的方法可能对你有用,但如果没有,这应该可以:
project("the_thing.html" NONE)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
717 次 |
最近记录: |