From a45928045a90493d45bd69244ea906d523900ba0 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 13 Dec 2019 17:52:40 +0300 Subject: [PATCH] Merge pull request #16150 from alalek:cmake_avoid_deprecated_link_private * cmake: avoid deprecated LINK_PRIVATE/LINK_PUBLIC see CMP0023 (CMake 2.8.12+) * cmake: fix 3rdparty list - don't include OpenCV modules --- 3rdparty/openvx/hal/CMakeLists.txt | 2 +- cmake/OpenCVDetectCUDA.cmake | 2 +- cmake/OpenCVModule.cmake | 18 +++++++++++------- cmake/OpenCVUtils.cmake | 11 ++++++++--- cmake/android/android_ant_projects.cmake | 2 +- modules/core/CMakeLists.txt | 2 +- modules/cudev/test/CMakeLists.txt | 2 +- modules/java/jni/CMakeLists.txt | 18 +++++++++++------- modules/python/common.cmake | 6 +++--- modules/viz/CMakeLists.txt | 4 ++-- samples/CMakeLists.example.in | 2 +- samples/android/CMakeLists.txt | 2 +- samples/cpp/CMakeLists.txt | 6 +++--- samples/cpp/example_cmake/CMakeLists.txt | 2 +- .../real_time_pose_estimation/CMakeLists.txt | 4 ++-- samples/directx/CMakeLists.txt | 2 +- samples/dnn/CMakeLists.txt | 2 +- samples/gpu/CMakeLists.txt | 6 +++--- samples/opencl/CMakeLists.txt | 2 +- samples/opengl/CMakeLists.txt | 4 ++-- samples/openvx/CMakeLists.txt | 2 +- samples/samples_utils.cmake | 2 +- samples/tapi/CMakeLists.txt | 2 +- samples/va_intel/CMakeLists.txt | 2 +- 24 files changed, 60 insertions(+), 47 deletions(-) diff --git a/3rdparty/openvx/hal/CMakeLists.txt b/3rdparty/openvx/hal/CMakeLists.txt index f5af67a3c8..4824c45a24 100644 --- a/3rdparty/openvx/hal/CMakeLists.txt +++ b/3rdparty/openvx/hal/CMakeLists.txt @@ -5,7 +5,7 @@ target_include_directories(openvx_hal PUBLIC ${CMAKE_SOURCE_DIR}/modules/core/include ${CMAKE_SOURCE_DIR}/modules/imgproc/include ${OPENVX_INCLUDE_DIR}) -target_link_libraries(openvx_hal LINK_PUBLIC ${OPENVX_LIBRARIES}) +target_link_libraries(openvx_hal PUBLIC ${OPENVX_LIBRARIES}) set_target_properties(openvx_hal PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}) if(NOT BUILD_SHARED_LIBS) ocv_install_target(openvx_hal EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index 18ab2f8289..84319f5971 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -12,7 +12,7 @@ endif() if(((NOT CMAKE_VERSION VERSION_LESS "3.9.0") # requires https://gitlab.kitware.com/cmake/cmake/merge_requests/663 OR OPENCV_CUDA_FORCE_EXTERNAL_CMAKE_MODULE) AND NOT OPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE) - ocv_update(CUDA_LINK_LIBRARIES_KEYWORD "LINK_PRIVATE") + ocv_update(CUDA_LINK_LIBRARIES_KEYWORD "PRIVATE") find_host_package(CUDA "${MIN_VER_CUDA}" QUIET) else() # Use OpenCV's patched "FindCUDA" module diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index f83ae6fec4..082290c710 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -934,11 +934,15 @@ macro(_ocv_create_module) set_source_files_properties(${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES} ${${the_module}_pch} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};Module") - ocv_target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS_TO_LINK}) - ocv_target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS_EXT}) - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_HAL_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) + ocv_target_link_libraries(${the_module} PUBLIC ${OPENCV_MODULE_${the_module}_DEPS_TO_LINK} + INTERFACE ${OPENCV_MODULE_${the_module}_DEPS_TO_LINK} + ) + ocv_target_link_libraries(${the_module} PUBLIC ${OPENCV_MODULE_${the_module}_DEPS_EXT} + INTERFACE ${OPENCV_MODULE_${the_module}_DEPS_EXT} + ) + ocv_target_link_libraries(${the_module} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_HAL_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) if (HAVE_CUDA) - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) + ocv_target_link_libraries(${the_module} PRIVATE ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) endif() if(OPENCV_MODULE_${the_module}_COMPILE_DEFINITIONS) @@ -1145,7 +1149,7 @@ function(ocv_add_perf_tests) source_group("Src" FILES "${${the_target}_pch}") ocv_add_executable(${the_target} ${OPENCV_PERF_${the_module}_SOURCES} ${${the_target}_pch}) ocv_target_include_modules(${the_target} ${perf_deps}) - ocv_target_link_libraries(${the_target} LINK_PRIVATE ${perf_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_PERF_${the_module}_DEPS}) + ocv_target_link_libraries(${the_target} PRIVATE ${perf_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_PERF_${the_module}_DEPS}) add_dependencies(opencv_perf_tests ${the_target}) set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};PerfTest") @@ -1226,7 +1230,7 @@ function(ocv_add_accuracy_tests) if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/test") ocv_target_include_directories(${the_target} "${CMAKE_CURRENT_BINARY_DIR}/test") endif() - ocv_target_link_libraries(${the_target} LINK_PRIVATE ${test_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_TEST_${the_module}_DEPS}) + ocv_target_link_libraries(${the_target} PRIVATE ${test_deps} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS} ${OPENCV_TEST_${the_module}_DEPS}) add_dependencies(opencv_tests ${the_target}) set_target_properties(${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module}_LABEL};AccuracyTest") @@ -1287,7 +1291,7 @@ function(ocv_add_samples) ocv_add_executable(${the_target} "${source}") ocv_target_include_modules(${the_target} ${samples_deps}) - ocv_target_link_libraries(${the_target} LINK_PRIVATE ${samples_deps}) + ocv_target_link_libraries(${the_target} PRIVATE ${samples_deps}) set_target_properties(${the_target} PROPERTIES PROJECT_LABEL "(sample) ${name}" diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index d1984d9826..86d4f04a78 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -1440,12 +1440,14 @@ endmacro() function(ocv_target_link_libraries target) set(LINK_DEPS ${ARGN}) _ocv_fix_target(target) - set(LINK_MODE "LINK_PRIVATE") + set(LINK_MODE "PRIVATE") set(LINK_PENDING "") foreach(dep ${LINK_DEPS}) if(" ${dep}" STREQUAL " ${target}") # prevent "link to itself" warning (world problem) - elseif(" ${dep}" STREQUAL " LINK_PRIVATE" OR " ${dep}" STREQUAL "LINK_PUBLIC") + elseif(" ${dep}" STREQUAL " LINK_PRIVATE" OR " ${dep}" STREQUAL " LINK_PUBLIC" # deprecated + OR " ${dep}" STREQUAL " PRIVATE" OR " ${dep}" STREQUAL " PUBLIC" OR " ${dep}" STREQUAL " INTERFACE" + ) if(NOT LINK_PENDING STREQUAL "") __ocv_push_target_link_libraries(${LINK_MODE} ${LINK_PENDING}) set(LINK_PENDING "") @@ -1584,7 +1586,10 @@ macro(ocv_get_all_libs _modules _extra _3rdparty) endif() if (TARGET ${dep}) get_target_property(_type ${dep} TYPE) - if(_type STREQUAL "STATIC_LIBRARY" AND BUILD_SHARED_LIBS OR _type STREQUAL "INTERFACE_LIBRARY") + if((_type STREQUAL "STATIC_LIBRARY" AND BUILD_SHARED_LIBS) + OR _type STREQUAL "INTERFACE_LIBRARY" + OR DEFINED OPENCV_MODULE_${dep}_LOCATION # OpenCV modules + ) # nothing else() get_target_property(_output ${dep} IMPORTED_LOCATION) diff --git a/cmake/android/android_ant_projects.cmake b/cmake/android/android_ant_projects.cmake index f80a81a8e9..c836f7ae5b 100644 --- a/cmake/android/android_ant_projects.cmake +++ b/cmake/android/android_ant_projects.cmake @@ -194,7 +194,7 @@ macro(add_android_project target path) add_library(${JNI_LIB_NAME} SHARED ${android_proj_jni_files}) ocv_target_include_modules_recurse(${JNI_LIB_NAME} ${android_proj_NATIVE_DEPS}) ocv_target_include_directories(${JNI_LIB_NAME} "${path}/jni") - ocv_target_link_libraries(${JNI_LIB_NAME} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS}) + ocv_target_link_libraries(${JNI_LIB_NAME} PRIVATE ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS}) set_target_properties(${JNI_LIB_NAME} PROPERTIES OUTPUT_NAME "${JNI_LIB_NAME}" diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 1d6da94e20..2e0fac6172 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -80,7 +80,7 @@ endif() ocv_create_module(${extra_libs}) -ocv_target_link_libraries(${the_module} LINK_PRIVATE +ocv_target_link_libraries(${the_module} PRIVATE "${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}" "${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}" "${ITT_LIBRARIES}" diff --git a/modules/cudev/test/CMakeLists.txt b/modules/cudev/test/CMakeLists.txt index ab9fd42529..986b240729 100644 --- a/modules/cudev/test/CMakeLists.txt +++ b/modules/cudev/test/CMakeLists.txt @@ -16,7 +16,7 @@ if(OCV_DEPENDENCIES_FOUND) ocv_cuda_filter_options() CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module}_SOURCES}) - ocv_target_link_libraries(${the_target} LINK_PRIVATE + ocv_target_link_libraries(${the_target} PRIVATE ${test_deps} ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ) add_dependencies(opencv_tests ${the_target}) diff --git a/modules/java/jni/CMakeLists.txt b/modules/java/jni/CMakeLists.txt index bfb948bfb7..b37d56cbf4 100644 --- a/modules/java/jni/CMakeLists.txt +++ b/modules/java/jni/CMakeLists.txt @@ -44,16 +44,16 @@ if(BUILD_FAT_JAVA_LIB) endif() if(APPLE) foreach(_dep ${__deps}) - ocv_target_link_libraries(${the_module} LINK_PRIVATE -Wl,-force_load "${_dep}") + ocv_target_link_libraries(${the_module} PRIVATE -Wl,-force_load "${_dep}") endforeach() elseif(((CV_GCC OR CV_CLANG OR UNIX) OR (OPENCV_FORCE_FAT_JAVA_LIB_LD_RULES)) AND (NOT OPENCV_SKIP_FAT_JAVA_LIB_LD_RULES)) - ocv_target_link_libraries(${the_module} LINK_PRIVATE -Wl,-whole-archive ${__deps} -Wl,-no-whole-archive) + ocv_target_link_libraries(${the_module} PRIVATE -Wl,-whole-archive ${__deps} -Wl,-no-whole-archive) else() - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${__deps}) + ocv_target_link_libraries(${the_module} PRIVATE ${__deps}) endif() - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${__extradeps} ${OPENCV_LINKER_LIBS}) + ocv_target_link_libraries(${the_module} PRIVATE ${__extradeps} ${OPENCV_LINKER_LIBS}) else() - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${__deps} ${OPENCV_LINKER_LIBS}) + ocv_target_link_libraries(${the_module} PRIVATE ${__deps} ${OPENCV_LINKER_LIBS}) endif() # Additional target properties @@ -66,8 +66,12 @@ set_target_properties(${the_module} PROPERTIES ) if(ANDROID) - ocv_target_link_libraries(${the_module} LINK_PUBLIC jnigraphics) # for Mat <=> Bitmap converters - ocv_target_link_libraries(${the_module} LINK_PUBLIC log dl z) + ocv_target_link_libraries(${the_module} PUBLIC jnigraphics # for Mat <=> Bitmap converters + INTERFACE jnigraphics + ) + ocv_target_link_libraries(${the_module} PUBLIC log dl z + INTERFACE log dl z + ) # force strip library after the build command # because samples and tests will make a copy of the library before install diff --git a/modules/python/common.cmake b/modules/python/common.cmake index 6a9d32d99a..b69d13d5ae 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -44,9 +44,9 @@ if(APPLE) set_target_properties(${the_module} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") elseif(WIN32 OR OPENCV_FORCE_PYTHON_LIBS) if(${PYTHON}_DEBUG_LIBRARIES AND NOT ${PYTHON}_LIBRARIES MATCHES "optimized.*debug") - ocv_target_link_libraries(${the_module} LINK_PRIVATE debug ${${PYTHON}_DEBUG_LIBRARIES} optimized ${${PYTHON}_LIBRARIES}) + ocv_target_link_libraries(${the_module} PRIVATE debug ${${PYTHON}_DEBUG_LIBRARIES} optimized ${${PYTHON}_LIBRARIES}) else() - ocv_target_link_libraries(${the_module} LINK_PRIVATE ${${PYTHON}_LIBRARIES}) + ocv_target_link_libraries(${the_module} PRIVATE ${${PYTHON}_LIBRARIES}) endif() endif() @@ -54,7 +54,7 @@ if(TARGET gen_opencv_python_source) set(deps ${OPENCV_MODULE_${the_module}_DEPS}) list(REMOVE_ITEM deps opencv_python_bindings_generator) # don't add dummy module to target_link_libraries list endif() -ocv_target_link_libraries(${the_module} LINK_PRIVATE ${deps}) +ocv_target_link_libraries(${the_module} PRIVATE ${deps}) if(DEFINED ${PYTHON}_CVPY_SUFFIX) set(CVPY_SUFFIX "${${PYTHON}_CVPY_SUFFIX}") diff --git a/modules/viz/CMakeLists.txt b/modules/viz/CMakeLists.txt index 1f1e1af3b9..256b464ee1 100644 --- a/modules/viz/CMakeLists.txt +++ b/modules/viz/CMakeLists.txt @@ -27,10 +27,10 @@ endif() ocv_warnings_disable(CMAKE_CXX_FLAGS -Winconsistent-missing-override -Wsuggest-override) ocv_define_module(viz opencv_core WRAP python) -ocv_target_link_libraries(${the_module} LINK_PRIVATE ${VTK_LIBRARIES}) +ocv_target_link_libraries(${the_module} PRIVATE ${VTK_LIBRARIES}) if(APPLE AND BUILD_opencv_viz) - ocv_target_link_libraries(${the_module} LINK_PRIVATE "-framework Cocoa") + ocv_target_link_libraries(${the_module} PRIVATE "-framework Cocoa") endif() if(TARGET opencv_test_viz) diff --git a/samples/CMakeLists.example.in b/samples/CMakeLists.example.in index cb741b76e1..9a00ac2991 100644 --- a/samples/CMakeLists.example.in +++ b/samples/CMakeLists.example.in @@ -39,4 +39,4 @@ message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") add_executable(${EXAMPLE_NAME} "${EXAMPLE_FILE}") # Link your application with OpenCV libraries -target_link_libraries(${EXAMPLE_NAME} LINK_PRIVATE ${OpenCV_LIBS}) +target_link_libraries(${EXAMPLE_NAME} PRIVATE ${OpenCV_LIBS}) diff --git a/samples/android/CMakeLists.txt b/samples/android/CMakeLists.txt index 5a863548f6..557419f20d 100644 --- a/samples/android/CMakeLists.txt +++ b/samples/android/CMakeLists.txt @@ -20,7 +20,7 @@ add_subdirectory(tutorial-4-opencl) if(HAVE_opencv_highgui) 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_link_libraries(hello-android LINK_PRIVATE ${OPENCV_LINKER_LIBS} opencv_imgcodecs opencv_videoio opencv_highgui opencv_core opencv_imgproc) + ocv_target_link_libraries(hello-android 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}") add_dependencies(opencv_android_examples hello-android) endif() diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 109675da04..ad251748c4 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -46,12 +46,12 @@ foreach(sample_filename ${cpp_samples}) set(package "tutorial") endif() ocv_define_sample(tgt ${sample_filename} ${package}) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) if(sample_filename MATCHES "/gpu/" AND HAVE_opencv_cudaarithm AND HAVE_opencv_cuda_filters) - ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_cudaarithm opencv_cudafilters) + ocv_target_link_libraries(${tgt} PRIVATE opencv_cudaarithm opencv_cudafilters) endif() if(sample_filename MATCHES "/viz/") - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${VTK_LIBRARIES}) + ocv_target_link_libraries(${tgt} PRIVATE ${VTK_LIBRARIES}) target_compile_definitions(${tgt} PRIVATE -DUSE_VTK) endif() if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser") diff --git a/samples/cpp/example_cmake/CMakeLists.txt b/samples/cpp/example_cmake/CMakeLists.txt index 078624a37c..c669660cef 100644 --- a/samples/cpp/example_cmake/CMakeLists.txt +++ b/samples/cpp/example_cmake/CMakeLists.txt @@ -27,4 +27,4 @@ endif() add_executable(opencv_example example.cpp) # Link your application with OpenCV libraries -target_link_libraries(opencv_example LINK_PRIVATE ${OpenCV_LIBS}) +target_link_libraries(opencv_example PRIVATE ${OpenCV_LIBS}) diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt index 2f63f048a0..5b5520f287 100644 --- a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt @@ -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_detection ${sample_dir}main_detection.cpp ${sample_pnplib} ) -ocv_target_link_libraries(${target}pnp_registration LINK_PRIVATE ${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}) +ocv_target_link_libraries(${target}pnp_registration PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) +ocv_target_link_libraries(${target}pnp_detection PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) diff --git a/samples/directx/CMakeLists.txt b/samples/directx/CMakeLists.txt index 961ed68a67..c1d4c5d0d1 100644 --- a/samples/directx/CMakeLists.txt +++ b/samples/directx/CMakeLists.txt @@ -17,5 +17,5 @@ ocv_include_modules_recurse(${tgt} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} directx) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DIRECTX_SAMPLES_REQUIRED_DEPS}) endforeach() diff --git a/samples/dnn/CMakeLists.txt b/samples/dnn/CMakeLists.txt index d1ec67f4ff..f2cb949d0a 100644 --- a/samples/dnn/CMakeLists.txt +++ b/samples/dnn/CMakeLists.txt @@ -18,5 +18,5 @@ ocv_include_modules_recurse(${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) file(GLOB_RECURSE dnn_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${dnn_samples}) ocv_define_sample(tgt ${sample_filename} dnn) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_DNN_SAMPLES_REQUIRED_DEPS}) endforeach() diff --git a/samples/gpu/CMakeLists.txt b/samples/gpu/CMakeLists.txt index d6f7d43320..eeab50a993 100644 --- a/samples/gpu/CMakeLists.txt +++ b/samples/gpu/CMakeLists.txt @@ -51,11 +51,11 @@ endif() file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} gpu) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS}) if(HAVE_opencv_xfeatures2d) - ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_xfeatures2d) + ocv_target_link_libraries(${tgt} PRIVATE opencv_xfeatures2d) endif() if(HAVE_opencv_cudacodec) - ocv_target_link_libraries(${tgt} LINK_PRIVATE opencv_cudacodec) + ocv_target_link_libraries(${tgt} PRIVATE opencv_cudacodec) endif() endforeach() diff --git a/samples/opencl/CMakeLists.txt b/samples/opencl/CMakeLists.txt index bb857ef448..d71e866ffa 100644 --- a/samples/opencl/CMakeLists.txt +++ b/samples/opencl/CMakeLists.txt @@ -31,7 +31,7 @@ ocv_include_directories(${OpenCL_INCLUDE_DIR}) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} opencl) - ocv_target_link_libraries(${tgt} LINK_PRIVATE + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENCL_SAMPLES_REQUIRED_DEPS} ${OpenCL_LIBRARY}) diff --git a/samples/opengl/CMakeLists.txt b/samples/opengl/CMakeLists.txt index adf48a8d16..1e5d68dfe5 100644 --- a/samples/opengl/CMakeLists.txt +++ b/samples/opengl/CMakeLists.txt @@ -23,9 +23,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) endif() foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} opengl) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS}) if(sample_filename STREQUAL "opengl_interop.cpp") - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${X11_LIBRARIES}) + ocv_target_link_libraries(${tgt} PRIVATE ${X11_LIBRARIES}) ocv_target_include_directories(${tgt} ${X11_INCLUDE_DIR}) endif() endforeach() diff --git a/samples/openvx/CMakeLists.txt b/samples/openvx/CMakeLists.txt index ad65f050c9..701184d369 100644 --- a/samples/openvx/CMakeLists.txt +++ b/samples/openvx/CMakeLists.txt @@ -21,5 +21,5 @@ add_definitions(-DIVX_HIDE_INFO_WARNINGS) file(GLOB_RECURSE cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${cpp_samples}) ocv_define_sample(tgt ${sample_filename} openvx) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS}) endforeach() diff --git a/samples/samples_utils.cmake b/samples/samples_utils.cmake index b39996aea1..845b4585ea 100644 --- a/samples/samples_utils.cmake +++ b/samples/samples_utils.cmake @@ -6,7 +6,7 @@ function(ocv_define_sample out_target source sub) set(the_target "example_${sub}_${name}") add_executable(${the_target} "${source}") if(TARGET Threads::Threads AND NOT OPENCV_EXAMPLES_DISABLE_THREADS) - target_link_libraries(${the_target} LINK_PRIVATE Threads::Threads) + target_link_libraries(${the_target} PRIVATE Threads::Threads) endif() set_target_properties(${the_target} PROPERTIES PROJECT_LABEL "(sample) ${name}") if(ENABLE_SOLUTION_FOLDERS) diff --git a/samples/tapi/CMakeLists.txt b/samples/tapi/CMakeLists.txt index c44e92dc73..1f00326137 100644 --- a/samples/tapi/CMakeLists.txt +++ b/samples/tapi/CMakeLists.txt @@ -22,5 +22,5 @@ ocv_include_modules_recurse(${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS}) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} tapi) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_TAPI_SAMPLES_REQUIRED_DEPS}) endforeach() diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt index 2974d41c8f..0e56951302 100644 --- a/samples/va_intel/CMakeLists.txt +++ b/samples/va_intel/CMakeLists.txt @@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS}) file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) foreach(sample_filename ${all_samples}) ocv_define_sample(tgt ${sample_filename} va_intel) - ocv_target_link_libraries(${tgt} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}) + ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}) endforeach()