cmake - 如何将没有价值的参数传递给 CMake?
问题描述
在CMake中,我可以传递一个没有值的变量作为参数,并检查它是否提供?
cmake -DPAR1=123 -DPAR2
# CMakeLists.txt
if (PAR2)
message("PAR2 detected")
else()
message("PAR2 not detected")
endif()
使用此代码,我得到错误:
Parse error in command line argument: -DPAR2
Should be: VAR:type=value
CMake Error: No cmake script provided.
CMake Error: Problem processing arguments. Aborting.
解决方案
推荐阅读
- php - 在标签中打印 WordPress 菜单
- python - discord.py 黑名单词或某些命令
- java - 无法解析符号“DatabaseChangeListener”
- c# - 值未绑定到选择菜单中的选定选项
- pdf - 使用 Latex 嵌入 pdf 的视频无法正确播放
- web-worker - 无法从网络工作者读取/写入文件
- javascript - JQuery 链接 onClick 事件发送图像 - 如何获取链接对象?
- android - Kotlin 中的 edittext.setText("str") 和 edittext.text.text="str" 有什么区别?
- c# - 如何使用 Mediator 配置 MassTransit 以发布消息?
- android - Android Gradle“Api”不适用于外部库