Compiling my current ParaView custom application with PV 5.12.0 ends up with tons of warning messages about Policy CMP0116 is not set. I can see what this policy is about - and now I should know what the ParaView build actually expects in it’s add_custom_command() CMake function call!?
I have now 3 options: set this policy in my own CMakeLists.txt to either “OLD” or “NEW”, or tell CMake to ignore warnings:
I guess that with “OLD” I do nothing wrong, because I assume that CMake version <=3.19 is ok for the build, but I may run into problems if the “old” behaviour would be eventually removed
I can go for “NEW”, but I would not have any idea whether this would cause trouble somewhere down the line - certainly in the most unexpected situation where I would never ever have a chance to trace some misbehaviour back to that option
I can simply suppress warning messages. This would end up with “OLD”, and at the same time I would also miss tons of other possibly useful messages
Any pragmatic recommendation?
PS: I just see that after adding to my main CMakeLists.txt the following line:
cmake_policy(SET CMP0116 OLD)
I still get the exactly same warnings! Even if I add that line to all my CMakeLists.txt files. So the additional question would be where to define this policy in such a way that it has any effect at all!? The warnings are all coming from the vtk_module_add_module() calls that I use to add all my new modules.
All my modules I am adding with a little CMakeLists.txt like this one:
set(classes
utilDebugLog)
set(headers
utilTrackDefs.h)
vtk_module_add_module(AthosGeoView::AtgDebugLog
CLASSES
${classes}
HEADERS
${headers})
# the only purpose of this is to bring the vtk.module file into QtCreator
add_custom_target(AtgDebugLog_module_spec
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vtk.module)
This is then the warning message that comes from each one of these “module generator” files:
CMake Warning (dev) at /home/cornelis/Main/develop/ParaView/Binaries/ParaView-v5.12.0/Release/lib/cmake/paraview-5.12/vtk/vtkModule.cmake:3663 (add_custom_command):
Policy CMP0116 is not set: Ninja generators transform DEPFILEs from
add_custom_command(). Run "cmake --help-policy CMP0116" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Call Stack (most recent call first):
/home/cornelis/Main/develop/ParaView/Binaries/ParaView-v5.12.0/Release/lib/cmake/paraview-5.12/vtk/vtkModule.cmake:4209 (_vtk_module_write_wrap_hierarchy)
Core/AtgDebugLog/CMakeLists.txt:7 (vtk_module_add_module)
This warning is for project developers. Use -Wno-dev to suppress it.
Conclusion from my side: Just ignore the warnings for now, and once I migrate to a new version, chances are that they will simply disappear without further changes in my code: Good news thus!