Skip to content

Commit

Permalink
CMake: Avoid target_link_libraries() with imported targets
Browse files Browse the repository at this point in the history
Versions of CMake prior to 3.11 do not support using
target_link_libraries() to setup INTERFACE_LINK_LIBRARIES.
Using set_property() directly works in all 3.x versions,
including 3.11 and newer.

Fixes #75

(cherry picked from commit c06f791)
  • Loading branch information
aperezdc committed Sep 18, 2019
1 parent 47ea09c commit d6f0686
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmake/FindEGL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)
if (EGL_LIBRARIES AND NOT TARGET GL::egl)
add_library(GL::egl INTERFACE IMPORTED)
if (TARGET PkgConfig::EGL)
target_link_libraries(GL::egl INTERFACE PkgConfig::EGL)
set_property(TARGET GL::egl PROPERTY
INTERFACE_LINK_LIBRARIES PkgConfig::EGL)
else ()
set_property(TARGET GL::egl PROPERTY
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY})
Expand Down
3 changes: 2 additions & 1 deletion cmake/FindWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ mark_as_advanced(WPE_INCLUDE_DIR WPE_LIBRARY)
if (WPE_LIBRARY AND NOT TARGET WPE::libwpe)
add_library(WPE::libwpe INTERFACE IMPORTED)
if (TARGET PkgConfig::WPE)
target_link_libraries(WPE::libwpe INTERFACE PkgConfig::WPE)
set_property(TARGET WPE::libwpe PROPERTY
INTERFACE_LINK_LIBRARIES PkgConfig::WPE)
else ()
set_property(TARGET WPE::libwpe PROPERTY
INTERFACE_LINK_LIBRARIES "${WPE_LIBRARY}")
Expand Down

0 comments on commit d6f0686

Please sign in to comment.