cmake - 没有 C 编译器的主机上的非 C 项目的 CMake
问题描述
我想使用 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
)
当我在我的 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".
这两个日志文件没有提供额外的线索。如何修复该项目以使其忽略缺少 C(和 C++)编译器?
解决方案
你需要明确地说没有语言。
project("the_thing.html"
LANGUAGES
NONE
)
那来自我的一个项目,但它使用现代 CMake(您的最低版本是 2.6)。以上可能对您有用,但如果不是,应该这样做:
project("the_thing.html" NONE)
推荐阅读
- anaconda - Conda virtual environment keeps using wrong version of Python
- java - How do I initialize an array of type String within a constructor in Java?
- docker - rename .docker_temp_134954455 seal:3.4.0.tar: protocol error when using Docker to save image
- snowflake-cloud-data-platform - 雪花随用随付
- javascript - 如果条件满足,如何仅将数组元素复制到电子表格
- spring-webflux - 如果单声道为空,怎么会有异常?
- docker - Docker没有在Linux上同步文件
- ffmpeg - ffmpeg mkv to mp4转换器会丢失部分音频,如何在python中配置?
- file-type - Geany 在打开时不会自动检测自定义文件类型
- r - 为什么将 emmeans 与 data.frame 对比而不报告正确的 p 值?