Skip to content

Commit

Permalink
cmake: set cmake policy CMP0060 to NEW
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
meyerj committed Oct 25, 2019
1 parent 4975233 commit 0157afa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down

0 comments on commit 0157afa

Please sign in to comment.