From 76b904b02269da81e675a91bc64614299d90ae6e Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 25 Oct 2013 13:54:55 +0400 Subject: [PATCH] Replaced our usage of LINK_PRIVATE with that of LINK_INTERFACE_LIBRARIES. The reasons for that are twofold: 1) LINK_PRIVATE is only available since CMake 2.8.7. 2) The way it was used generated a warning because of CMake policy CMP0023: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#policy:CMP0023 Using LINK_INTERFACE_LIBRARIES actually causes another warning - this time because of CMake policy CMP0022: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#policy:CMP0022 I set the policy to OLD, because NEW means subtle changes when compiling with CMake 2.8.12, and I don't want to research that this close to release. :-) I also removed the setting of CMP0003, because it's set by cmake_minimal_version anyway. --- CMakeLists.txt | 13 ++++--------- cmake/OpenCVModule.cmake | 5 +++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 704c51be8c..e3326982e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,6 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) -# -------------------------------------------------------------- -# Indicate CMake 2.7 and above that we don't want to mix relative -# and absolute paths in linker lib lists. -# Run "cmake --help-policy CMP0003" for more information. -# -------------------------------------------------------------- -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif() - # Following block can broke build in case of cross-compilng # but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command # so we will try to detect crosscompiling by presense of CMAKE_TOOLCHAIN_FILE @@ -48,6 +39,10 @@ else() cmake_minimum_required(VERSION 2.6.3) endif() +if(POLICY CMP0022) + cmake_policy(SET CMP0022 OLD) +endif() + # must go before the project command set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 86ce881240..024a9d91e2 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -535,9 +535,10 @@ macro(ocv_create_module) if(NOT "${ARGN}" STREQUAL "SKIP_LINK") target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS}) - target_link_libraries(${the_module} LINK_PRIVATE ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) + target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS}) + target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) if (HAVE_CUDA) - target_link_libraries(${the_module} LINK_PRIVATE ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) + target_link_libraries(${the_module} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) endif() endif()