Fix TargetX11 helper

LT1AB
Ryan Burns 2020-05-28 16:59:39 -07:00
parent 6cd15a5bcd
commit 58e39cce25
1 changed files with 6 additions and 5 deletions

View File

@ -5,6 +5,9 @@ set(components
find_package(X11 COMPONENTS ${components})
# The X11::{component} targets only exist for CMake 3.14,
# so we create them here for backwards compatibility.
if(X11_FOUND)
# make X11 look like a regular find_package component
@ -13,11 +16,9 @@ if(X11_FOUND)
list(APPEND components X11)
foreach(component ${components})
message("${component} include = ${X11_${component}_INCLUDE_PATH}")
if(X11_${component}_FOUND)
if(NOT TARGET X11::${component})
add_library(X11::${component} IMPORTED INTERFACE)
endif()
if(X11_${component}_FOUND AND
NOT TARGET X11::${component})
add_library(X11::${component} IMPORTED INTERFACE)
target_link_libraries(X11::${component}
INTERFACE ${X11_${component}_LIB})
target_include_directories(X11::${component} SYSTEM