Skip to content

Commit

Permalink
Add target_link_directory() compat function
Browse files Browse the repository at this point in the history
We need this function to deal with pkgconfig files properly, but
unfortunately it doesn't exist until CMake 3.13, and we need to support
CMake 3.10. So add a hacky compatibility function for older systems.
  • Loading branch information
CendioOssman committed Jun 7, 2022
1 parent 6c7c022 commit 115d3f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ include(CheckCSourceRuns)

include(CMakeMacroLibtoolFile)

include(cmake/TargetLinkDirectories.cmake)

project(tigervnc)
set(VERSION 1.12.80)

Expand Down
12 changes: 12 additions & 0 deletions cmake/TargetLinkDirectories.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Compatibility replacement of target_link_directories() for older cmake

if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
function(target_link_directories TARGET SCOPE)
get_target_property(INTERFACE_LINK_LIBRARIES ${TARGET} INTERFACE_LINK_LIBRARIES)
foreach(DIRECTORY ${ARGN})
list(INSERT INTERFACE_LINK_LIBRARIES 0 "-L${DIRECTORY}")
endforeach()
set_target_properties(${TARGET} PROPERTIES
INTERFACE_LINK_LIBRARIES "${INTERFACE_LINK_LIBRARIES}")
endfunction()
endif()

0 comments on commit 115d3f8

Please sign in to comment.