Skip to content

Commit d25b041

Browse files
committed
cmake: CMP0022 NEW
1 parent 268d17e commit d25b041

File tree

7 files changed

+19
-25
lines changed

7 files changed

+19
-25
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ else()
4444
cmake_minimum_required(VERSION 2.8.12.2)
4545
endif()
4646

47-
if(POLICY CMP0022)
48-
cmake_policy(SET CMP0022 OLD)
49-
endif()
50-
5147
if(POLICY CMP0026)
5248
# silence cmake 3.0+ warnings about reading LOCATION attribute
5349
cmake_policy(SET CMP0026 OLD)

cmake/FindCUDA.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ macro(CUDA_ADD_LIBRARY cuda_target)
15531553
# variable will have been defined.
15541554
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
15551555

1556-
target_link_libraries(${cuda_target}
1556+
target_link_libraries(${cuda_target} LINK_PRIVATE
15571557
${CUDA_LIBRARIES}
15581558
)
15591559

@@ -1597,7 +1597,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target)
15971597
# variable will have been defined.
15981598
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")
15991599

1600-
target_link_libraries(${cuda_target}
1600+
target_link_libraries(${cuda_target} LINK_PRIVATE
16011601
${CUDA_LIBRARIES}
16021602
)
16031603

@@ -1672,9 +1672,9 @@ endmacro()
16721672
###############################################################################
16731673
macro(CUDA_ADD_CUFFT_TO_TARGET target)
16741674
if (CUDA_BUILD_EMULATION)
1675-
target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
1675+
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cufftemu_LIBRARY})
16761676
else()
1677-
target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
1677+
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cufft_LIBRARY})
16781678
endif()
16791679
endmacro()
16801680

@@ -1685,9 +1685,9 @@ endmacro()
16851685
###############################################################################
16861686
macro(CUDA_ADD_CUBLAS_TO_TARGET target)
16871687
if (CUDA_BUILD_EMULATION)
1688-
target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
1688+
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cublasemu_LIBRARY})
16891689
else()
1690-
target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
1690+
target_link_libraries(${target} LINK_PRIVATE ${CUDA_cublas_LIBRARY})
16911691
endif()
16921692
endmacro()
16931693

cmake/OpenCVDetectAndroidSDK.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ macro(add_android_project target path)
302302
endif()
303303

304304
add_library(${JNI_LIB_NAME} SHARED ${android_proj_jni_files})
305-
target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
305+
target_link_libraries(${JNI_LIB_NAME} LINK_PRIVATE ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
306306

307307
set_target_properties(${JNI_LIB_NAME} PROPERTIES
308308
OUTPUT_NAME "${JNI_LIB_NAME}"

cmake/OpenCVModule.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,12 +578,12 @@ macro(ocv_create_module)
578578
${${the_module}_pch})
579579

580580
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
581-
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
582-
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
581+
target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS})
582+
target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS})
583583
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
584584
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
585-
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
586-
target_link_libraries(${the_module} ${extra_deps})
585+
target_link_libraries(${the_module} LINK_PRIVATE ${_simple_deps}) # this list goes to "export"
586+
target_link_libraries(${the_module} LINK_PRIVATE ${extra_deps})
587587
endif()
588588

589589
add_dependencies(opencv_modules ${the_module})

modules/highgui/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,6 @@ if(MSVC)
293293
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
294294
endif()
295295

296-
#stop automatic dependencies propagation for this module
297-
set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
298-
299296
ocv_add_precompiled_headers(${the_module})
300297
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations -Wno-clobbered)
301298

modules/java/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,20 @@ if(BUILD_FAT_JAVA_LIB)
314314
endif()
315315
if(APPLE)
316316
foreach(_dep ${__deps})
317-
target_link_libraries(${the_module} -Wl,-force_load "${_dep}")
317+
target_link_libraries(${the_module} LINK_PRIVATE -Wl,-force_load "${_dep}")
318318
endforeach()
319319
else()
320-
target_link_libraries(${the_module} -Wl,-whole-archive ${__deps} -Wl,-no-whole-archive)
320+
target_link_libraries(${the_module} LINK_PRIVATE -Wl,-whole-archive ${__deps} -Wl,-no-whole-archive)
321321
endif()
322-
target_link_libraries(${the_module} ${__extradeps} ${OPENCV_LINKER_LIBS})
322+
target_link_libraries(${the_module} LINK_PRIVATE ${__extradeps} ${OPENCV_LINKER_LIBS})
323323
else()
324-
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS})
324+
target_link_libraries(${the_module} LINK_PRIVATE ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_LINKER_LIBS})
325325
endif()
326326

327327
if(ANDROID)
328-
target_link_libraries(${the_module} jnigraphics) # for Mat <=> Bitmap converters
328+
target_link_libraries(${the_module} LINK_PUBLIC jnigraphics) # for Mat <=> Bitmap converters
329+
target_link_libraries(${the_module} LINK_PUBLIC log dl z)
330+
target_link_libraries(${the_module} LINK_PRIVATE ${OPENCV_LINKER_LIBS})
329331

330332
# force strip library after the build command
331333
# because samples and tests will make a copy of the library before install
@@ -343,7 +345,6 @@ set_target_properties(${the_module} PROPERTIES
343345
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
344346
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
345347
INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH}
346-
LINK_INTERFACE_LIBRARIES ""
347348
)
348349

349350
if(WIN32)

modules/viz/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(the_description "Viz")
77
ocv_define_module(viz opencv_core ${VTK_LIBRARIES})
88

99
if(APPLE AND BUILD_opencv_viz)
10-
target_link_libraries(opencv_viz "-framework Cocoa")
10+
target_link_libraries(opencv_viz LINK_PRIVATE "-framework Cocoa")
1111
endif()
1212

1313
if(TARGET opencv_test_viz)

0 commit comments

Comments
 (0)