From cf628b38abaf5a8b6b4176b8c8d1d6acaaa1c5fc Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sat, 23 Jul 2022 21:24:53 +0200 Subject: [PATCH] bugfixed OpenCV install for newer MSVC OpenCV-builds --- cmake/jkqtplotter_deployopencv.cmake | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmake/jkqtplotter_deployopencv.cmake b/cmake/jkqtplotter_deployopencv.cmake index e47f41a5f2..659facd74e 100644 --- a/cmake/jkqtplotter_deployopencv.cmake +++ b/cmake/jkqtplotter_deployopencv.cmake @@ -1,12 +1,20 @@ function(jkqtplotter_deployopencv TARGET_NAME) - #use windeploy if(OpenCV_FOUND) if(WIN32) - add_custom_command(TARGET ${EXENAME} POST_BUILD # Adds a post-build event the TARGET - COMMAND ${CMAKE_COMMAND} -E copy_directory - "${_OpenCV_LIB_PATH}" - $ + if (EXISTS ${_OpenCV_LIB_PATH}) + add_custom_command(TARGET ${EXENAME} POST_BUILD # Adds a post-build event the TARGET + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${_OpenCV_LIB_PATH}" + "$" ) + endif() + if (EXISTS ${OpenCV_INSTALL_PATH}/bin) + add_custom_command(TARGET ${EXENAME} POST_BUILD # Adds a post-build event the TARGET + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${OpenCV_INSTALL_PATH}/bin" + "$" + ) + endif() endif(WIN32) endif(OpenCV_FOUND) endfunction(jkqtplotter_deployopencv)