From 0157afa67b2565309736fdf501137c6bdbc8ea94 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 7 Mar 2018 12:26:52 +0100 Subject: [PATCH] cmake: set cmake policy CMP0060 to NEW Link libraries by full path even in implicit directories: https://cmake.org/cmake/help/v3.5/policy/CMP0060.html This fixes a linker error with CMake 3.5, which as a result of target_link_libraries(orocos-rtt-${OROCOS_TARGET}_dynamic /full/path/to/liblog4cpp.so) adds -llog4cpp to the linker command line, which results in a linker error: /usr/bin/ld: cannot find -llog4cpp Not sure why the install-space is considered as an implicit link directory by CMake. Signed-off-by: Johannes Meyer --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd7081a93..a30f43a98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,24 @@ # CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) -# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003") +# CMP0003: Libraries linked via full path no longer produce linker search paths +# (see "cmake --help-policy CMP0003") IF(POLICY CMP0003) CMAKE_POLICY(SET CMP0003 NEW) ENDIF(POLICY CMP0003) -# Suppress cmake policy warning in included rtt_macros.cmake file in CMake >= 3.0.2 (see "cmake --help-policy CMP0026") +# CMP0026: Suppress cmake policy warning in included rtt_macros.cmake file (CMake >= 3.0.2) +# (see "cmake --help-policy CMP0026") if(POLICY CMP0026) cmake_policy(SET CMP0026 OLD) endif() +# CMP0060: Link libraries by full path even in implicit directories (CMake >= 3.3) +# (see "cmake --help-policy CMP0060") +IF(POLICY CMP0060) + CMAKE_POLICY(SET CMP0060 NEW) +ENDIF(POLICY CMP0060) + ################################################### # # # Start project customization section #