Commit 88996323 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #14569 from alalek:fixup_14558

parents 8b192b76 18151e79
...@@ -39,4 +39,4 @@ message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") ...@@ -39,4 +39,4 @@ message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
add_executable(${EXAMPLE_NAME} "${EXAMPLE_FILE}") add_executable(${EXAMPLE_NAME} "${EXAMPLE_FILE}")
# Link your application with OpenCV libraries # Link your application with OpenCV libraries
target_link_libraries(${EXAMPLE_NAME} ${OpenCV_LIBS}) target_link_libraries(${EXAMPLE_NAME} LINK_PRIVATE ${OpenCV_LIBS})
...@@ -20,7 +20,7 @@ add_subdirectory(tutorial-4-opencl) ...@@ -20,7 +20,7 @@ add_subdirectory(tutorial-4-opencl)
if(HAVE_opencv_highgui) if(HAVE_opencv_highgui)
add_executable(hello-android hello-android/main.cpp) add_executable(hello-android hello-android/main.cpp)
ocv_target_include_modules_recurse(hello-android opencv_imgcodecs opencv_videoio opencv_highgui opencv_core opencv_imgproc) ocv_target_include_modules_recurse(hello-android opencv_imgcodecs opencv_videoio opencv_highgui opencv_core opencv_imgproc)
ocv_target_link_libraries(hello-android ${OPENCV_LINKER_LIBS} opencv_imgcodecs opencv_videoio opencv_highgui opencv_core opencv_imgproc) ocv_target_link_libraries(hello-android LINK_PRIVATE ${OPENCV_LINKER_LIBS} opencv_imgcodecs opencv_videoio opencv_highgui opencv_core opencv_imgproc)
set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
add_dependencies(opencv_android_examples hello-android) add_dependencies(opencv_android_examples hello-android)
endif() endif()
...@@ -46,12 +46,12 @@ foreach(sample_filename ${cpp_samples}) ...@@ -46,12 +46,12 @@ foreach(sample_filename ${cpp_samples})
set(package "tutorial") set(package "tutorial")
endif() endif()
ocv_define_sample(tgt ${sample_filename} ${package}) ocv_define_sample(tgt ${sample_filename} ${package})
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
if(sample_filename MATCHES "/gpu/" AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters) if(sample_filename MATCHES "/gpu/" AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters)
ocv_target_link_libraries(${tgt} opencv_cudaarithm opencv_cudafilters) ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_cudaarithm opencv_cudafilters)
endif() endif()
if(sample_filename MATCHES "/viz/") if(sample_filename MATCHES "/viz/")
ocv_target_link_libraries(${tgt} ${VTK_LIBRARIES}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(${tgt} PRIVATE -DUSE_VTK) target_compile_definitions(${tgt} PRIVATE -DUSE_VTK)
endif() endif()
if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser") if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser")
......
...@@ -27,4 +27,4 @@ endif() ...@@ -27,4 +27,4 @@ endif()
add_executable(opencv_example example.cpp) add_executable(opencv_example example.cpp)
# Link your application with OpenCV libraries # Link your application with OpenCV libraries
target_link_libraries(opencv_example ${OpenCV_LIBS}) target_link_libraries(opencv_example LINK_PRIVATE ${OpenCV_LIBS})
...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) ...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
add_executable( ${target}pnp_registration ${sample_dir}main_registration.cpp ${sample_pnplib} ) add_executable( ${target}pnp_registration ${sample_dir}main_registration.cpp ${sample_pnplib} )
add_executable( ${target}pnp_detection ${sample_dir}main_detection.cpp ${sample_pnplib} ) add_executable( ${target}pnp_detection ${sample_dir}main_detection.cpp ${sample_pnplib} )
ocv_target_link_libraries( ${target}pnp_registration ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS} ) ocv_target_link_libraries(${target}pnp_registration LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
ocv_target_link_libraries( ${target}pnp_detection ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS} ) ocv_target_link_libraries(${target}pnp_detection LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${tgt} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) ...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${tgt} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS})
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} directx) ocv_define_sample(tgt ${sample_filename} directx)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS})
endforeach() endforeach()
...@@ -18,5 +18,5 @@ ocv_include_modules_recurse(${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) ...@@ -18,5 +18,5 @@ ocv_include_modules_recurse(${OPENCV_DNN_SAMPLES_REQUIRED_DEPS})
file(GLOB_RECURSE dnn_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB_RECURSE dnn_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${dnn_samples}) foreach(sample_filename ${dnn_samples})
ocv_define_sample(tgt ${sample_filename} dnn) ocv_define_sample(tgt ${sample_filename} dnn)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DNN_SAMPLES_REQUIRED_DEPS})
endforeach() endforeach()
...@@ -51,11 +51,11 @@ endif() ...@@ -51,11 +51,11 @@ endif()
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} gpu) ocv_define_sample(tgt ${sample_filename} gpu)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS})
if(HAVE_opencv_xfeatures2d) if(HAVE_opencv_xfeatures2d)
ocv_target_link_libraries(${tgt} opencv_xfeatures2d) ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_xfeatures2d)
endif() endif()
if(HAVE_opencv_cudacodec) if(HAVE_opencv_cudacodec)
ocv_target_link_libraries(${tgt} opencv_cudacodec) ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_cudacodec)
endif() endif()
endforeach() endforeach()
...@@ -31,7 +31,7 @@ ocv_include_directories(${OpenCL_INCLUDE_DIR}) ...@@ -31,7 +31,7 @@ ocv_include_directories(${OpenCL_INCLUDE_DIR})
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} opencl) ocv_define_sample(tgt ${sample_filename} opencl)
ocv_target_link_libraries(${tgt} ocv_target_link_libraries(${tgt} LINK_PRIVATE
${OPENCV_LINKER_LIBS} ${OPENCV_LINKER_LIBS}
${OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS} ${OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS}
${OpenCL_LIBRARY}) ${OpenCL_LIBRARY})
......
...@@ -23,9 +23,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) ...@@ -23,9 +23,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endif() endif()
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} opengl) ocv_define_sample(tgt ${sample_filename} opengl)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS})
if(sample_filename STREQUAL "opengl_interop.cpp") if(sample_filename STREQUAL "opengl_interop.cpp")
ocv_target_link_libraries(${tgt} ${X11_LIBRARIES}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${X11_LIBRARIES})
ocv_target_include_directories(${tgt} ${X11_INCLUDE_DIR}) ocv_target_include_directories(${tgt} ${X11_INCLUDE_DIR})
endif() endif()
endforeach() endforeach()
......
...@@ -21,5 +21,5 @@ add_definitions(-DIVX_HIDE_INFO_WARNINGS) ...@@ -21,5 +21,5 @@ add_definitions(-DIVX_HIDE_INFO_WARNINGS)
file(GLOB_RECURSE cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB_RECURSE cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${cpp_samples}) foreach(sample_filename ${cpp_samples})
ocv_define_sample(tgt ${sample_filename} openvx) ocv_define_sample(tgt ${sample_filename} openvx)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS})
endforeach() endforeach()
...@@ -22,5 +22,5 @@ ocv_include_modules_recurse(${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS}) ...@@ -22,5 +22,5 @@ ocv_include_modules_recurse(${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS})
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} tapi) ocv_define_sample(tgt ${sample_filename} tapi)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS})
endforeach() endforeach()
...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS}) ...@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(sample_filename ${all_samples}) foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} va_intel) ocv_define_sample(tgt ${sample_filename} va_intel)
ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}) ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
endforeach() endforeach()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment