我不确定在哪里设置cmake_policy。该链接已解释了cmake_policy。但是不确定在哪里设置cmake策略。我使用cmake构建Opencv,并且有很多警告,例如
CMake Warning (dev) at cuda_compile_generated_row_filter.2.cu.o.cmake:137 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
我需要设置为cmake_policy(SET CMP0054 NEW)
。在哪里设定这项政策?我喜欢
ppp@ppp-Inspiron-7537:~/Softwares/opencv-2.4.9/build$ cmake_policy(SET CMP0054 NEW)
bash: syntax error near unexpected token `SET'
但我有错误。如何设置政策?
用于禁止开发人员使用的警告的使用-Wno-dev
选项cmake
:
cmake -Wno-dev <other-options> <source-dir>
或者,如果要为项目设置策略,则需要修改其CMakeLists.txt
文件并添加行
cmake_policy(SET CMP0054 OLD)
一开始的某个地方。
请注意,您需要对属性使用OLD值,因为项目很可能依赖于此类变量的取消引用。设置新值可能会破坏项目的功能。
固定项目代码后,即使没有明确的策略设置,也不会生成警告。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句