[all] use cmake FindPkgConfig IMPORTED_TARGETs

This commit is contained in:
arcnmx 2021-07-23 18:47:54 -07:00 committed by Geoffrey McRae
parent aa2ea05af9
commit 3b37898eb2
6 changed files with 19 additions and 26 deletions

View file

@ -12,7 +12,7 @@ set(OPTIMIZE_FOR_NATIVE_DEFAULT ON)
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
find_package(PkgConfig)
pkg_check_modules(FONTCONFIG_PKGCONFIG REQUIRED fontconfig)
pkg_check_modules(FONTCONFIG REQUIRED IMPORTED_TARGET fontconfig)
option(ENABLE_OPENGL "Enable the OpenGL renderer" ON)
add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Legacy OpenGL renderer.")
@ -90,7 +90,6 @@ add_custom_command(
include_directories(
${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
${FONTCONFIG_PKGCONFIG_INCLUDE_DIRS}
)
link_libraries(
@ -139,7 +138,7 @@ target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_
target_link_libraries(looking-glass-client
${EXE_FLAGS}
${FONTCONFIG_PKGCONFIG_LIBRARIES}
PkgConfig::FONTCONFIG
lg_common
displayservers
lgmp

View file

@ -2,21 +2,18 @@ cmake_minimum_required(VERSION 3.0)
project(displayserver_Wayland LANGUAGES C)
find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_Wayland_PKGCONFIG REQUIRED
pkg_check_modules(DISPLAYSERVER_Wayland REQUIRED IMPORTED_TARGET
wayland-client
)
#pkg_check_modules(DISPLAYSERVER_Wayland_OPT_PKGCONFIG
#)
set(DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES "")
set(displayserver_Wayland_SHELL_SRC "")
if (ENABLE_LIBDECOR)
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED IMPORTED_TARGET
libdecor-0
)
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_LIBRARIES ${DISPLAYSERVER_Wayland_LIBDECOR_LIBRARIES})
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_INCLUDE_DIRS ${DISPLAYSERVER_Wayland_LIBDECOR_INCLUDE_DIRS})
list(APPEND DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES PkgConfig::DISPLAYSERVER_Wayland_LIBDECOR)
list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c)
add_compile_definitions(ENABLE_LIBDECOR)
else()
@ -40,7 +37,7 @@ add_library(displayserver_Wayland STATIC
)
target_link_libraries(displayserver_Wayland
${DISPLAYSERVER_Wayland_PKGCONFIG_LIBRARIES}
PkgConfig::DISPLAYSERVER_Wayland
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES}
lg_common
)
@ -48,8 +45,6 @@ target_link_libraries(displayserver_Wayland
target_include_directories(displayserver_Wayland
PRIVATE
src
${DISPLAYSERVER_Wayland_PKGCONFIG_INCLUDE_DIRS}
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_INCLUDE_DIRS}
)
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(displayserver_X11 LANGUAGES C)
find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_X11_PKGCONFIG REQUIRED
pkg_check_modules(DISPLAYSERVER_X11 REQUIRED IMPORTED_TARGET
x11
xi
xfixes
@ -19,12 +19,11 @@ add_library(displayserver_X11 STATIC
add_definitions(-D GLX_GLXEXT_PROTOTYPES)
target_link_libraries(displayserver_X11
${DISPLAYSERVER_X11_PKGCONFIG_LIBRARIES}
PkgConfig::DISPLAYSERVER_X11
lg_common
)
target_include_directories(displayserver_X11
PRIVATE
src
${DISPLAYSERVER_X11_PKGCONFIG_INCLUDE_DIRS}
)

View file

@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.0)
project(renderer_EGL LANGUAGES C CXX)
find_package(PkgConfig)
pkg_check_modules(RENDERER_EGL_PKGCONFIG REQUIRED
pkg_check_modules(RENDERER_EGL REQUIRED IMPORTED_TARGET
egl
gl
)
pkg_check_modules(RENDERER_EGL_OPT_PKGCONFIG
pkg_check_modules(RENDERER_EGL_OPT IMPORTED_TARGET
wayland-egl
)
@ -51,17 +51,19 @@ add_library(renderer_EGL STATIC
target_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3)
target_link_libraries(renderer_EGL
${RENDERER_EGL_PKGCONFIG_LIBRARIES}
${RENDERER_EGL_OPT_PKGCONFIG_LIBRARIES}
PkgConfig::RENDERER_EGL
lg_common
cimgui
)
if(RENDERER_EGL_OPT_FOUND)
target_link_libraries(renderer_EGL
PkgConfig::RENDERER_EGL_OPT
)
endif()
target_include_directories(renderer_EGL
PRIVATE
src
${EGL_SHADER_INCS}
${RENDERER_EGL_PKGCONFIG_INCLUDE_DIRS}
${RENDERER_EGL_OPT_PKGCONFIG_INCLUDE_DIRS}
)

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(renderer_Opengl LANGUAGES C CXX)
find_package(PkgConfig)
pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
pkg_check_modules(RENDERER_OPENGL REQUIRED IMPORTED_TARGET
gl
)
@ -14,7 +14,7 @@ add_library(renderer_OpenGL STATIC
target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
target_link_libraries(renderer_OpenGL
${RENDERER_OPENGL_PKGCONFIG_LIBRARIES}
PkgConfig::RENDERER_OPENGL
lg_common
cimgui
@ -23,5 +23,4 @@ target_link_libraries(renderer_OpenGL
target_include_directories(renderer_OpenGL
PRIVATE
src
${RENDERER_OPENGL_PKGCONFIG_INCLUDE_DIRS}
)

View file

@ -38,7 +38,6 @@ add_custom_command(
include_directories(
${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
${PKGCONFIG_INCLUDE_DIRS}
)
#link_libraries(