用于缓存的 CMake 预加载脚本 [英] CMake preload script for cache
问题描述
我使用 -C mysettings.cmake 启动 cmake.
I fire cmake with the -C mysettings.cmake.
myfile.cmake 的内容是
The content of myfile.cmake is
set(CMAKE_INSTALL_PREFIX "C:/install/mylib" STRING)
一切都已生成,但似乎未设置 -C mysettings.cmake 变量.它仍然安装在默认目录中.
Everything is generated but it seems the -C mysettings.cmake variable is not set. It is still installed in the default directory.
Cmake 打印消息正在加载初始缓存文件 ../../script/cmake/mysettings.cmake"没有任何错误.
Cmake prints the message "loading initial cache file ../../script/cmake/mysettings.cmake" without any error.
完整的电话:
cmake -C ../../script/cmake/mysettings.cmake -G "Visual Studio 9 2008" ../../source/mylib
我的语法有问题吗?
推荐答案
来自 CMake 手册:
给定的文件应该是一个包含 SET 命令的 CMake 脚本使用 CACHE 选项,而不是缓存格式文件.
The given file should be a CMake script containing SET commands that use the CACHE option, not a cache-format file.
所以你的 myfile.cmake
需要看起来像这样:
So your myfile.cmake
needs to look something like this:
set(CMAKE_INSTALL_PREFIX "C:/install/mylib" CACHE PATH "")
这篇关于用于缓存的 CMake 预加载脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!