I am not sure where to set cmake_policy. This link has explained cmake_policy. But not sure where to set cmake policy. I use cmake to build Opencv and I have a lot of warnings like
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.
I need to set like cmake_policy(SET CMP0054 NEW)
.
Where to set this policy?
I did like
ppp@ppp-Inspiron-7537:~/Softwares/opencv-2.4.9/build$ cmake_policy(SET CMP0054 NEW)
bash: syntax error near unexpected token `SET'
but I got error. How can I set the policy?
Use
-Wno-dev
option forcmake
for suppress warnings intended for developers:Alternatively, if you want to set policy for the project, you need to modify its
CMakeLists.txt
file and add linesomewhere at the beginning.
Note, that you need to use OLD value for the property, as the project most likely relies on such variable's dereference. Setting NEW value will probably break project's functionality.
When project's code will be fixed, warnings won't be generated even without explicit policy set.