cmake: fix Ninja generator warning about pylintrc
authorAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 10 Apr 2018 09:23:10 +0000 (12:23 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 10 Apr 2018 09:23:10 +0000 (12:23 +0300)
CMake generated files is a part of target depends list.
Details: `cmake --help-policy CMP0058`

cmake/OpenCVPylint.cmake

index 08fd28b..50da730 100644 (file)
@@ -97,7 +97,11 @@ function(ocv_pylint_finalize)
     return()
   endif()
 
-  file(COPY "${CMAKE_SOURCE_DIR}/platforms/scripts/pylintrc" DESTINATION "${CMAKE_BINARY_DIR}")
+  add_custom_command(
+      OUTPUT "${CMAKE_BINARY_DIR}/pylintrc"
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/platforms/scripts/pylintrc" "${CMAKE_BINARY_DIR}/pylintrc"
+      DEPENDS "${CMAKE_SOURCE_DIR}/platforms/scripts/pylintrc"
+  )
 
   set(PYLINT_CONFIG_SCRIPT "")
   ocv_cmake_script_append_var(PYLINT_CONFIG_SCRIPT