CMAKE:根据生成器类型有条件地初始化缓存变量
我目前有一个基本的 Cmake 文件,用于设置某些库目录。我想根据目标生成器有条件地初始化——在我的例子中,生成器确定要使用哪些基本目录(64 位 Visual Studio 生成器与常规 Visual Studio 生成器)。
我的 CMakeLists 文件如下所示:
PROJECT(STAT_AUTH)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(BOOST_DIR "c:\\dev_32\\Boost" CACHE PATH "The Boost Directory Path")
SET(PROTOBUF_DIR "c:\\dev_32\\Protobuf" CACHE PATH "The Protobuf directory Path")
SET(OPENSSL_DIR "c:\\dev_32\\OpenSSL" CACHE PATH "The OpenSSL Directory Path"
如何有条件地初始化变量,以便在生成 64 位生成器时将它们设置为 64 位版本。在我选择“生成”选项之前,默认设置应该显示在 Cmake Gui / ccmake 中。
I currently have a basic Cmake file that sets certain library directories. I would like to conditionally intitalise based on the target generator -- in my case the generator determines which base directories to use (64-bit visual studio generator vs a regular visual studio generator).
My CMakeLists file looks as follows:
PROJECT(STAT_AUTH)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(BOOST_DIR "c:\\dev_32\\Boost" CACHE PATH "The Boost Directory Path")
SET(PROTOBUF_DIR "c:\\dev_32\\Protobuf" CACHE PATH "The Protobuf directory Path")
SET(OPENSSL_DIR "c:\\dev_32\\OpenSSL" CACHE PATH "The OpenSSL Directory Path"
How do I conditionally initialise the variables so they get set to 64-bit versions when I generate to 64-bit generators. The default setting should show up in the Cmake Gui / ccmake before I choose the "generate" option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
Try:
对于 Windows,以下语法是合适的。 CMAKE_CL_64专门定义了x86_64编译器。
For Windows the following syntax is apt. CMAKE_CL_64 defines the x86_64 compiler specifically.