[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) include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
find_package(PkgConfig) 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) option(ENABLE_OPENGL "Enable the OpenGL renderer" ON)
add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Legacy OpenGL renderer.") add_feature_info(ENABLE_OPENGL ENABLE_OPENGL "Legacy OpenGL renderer.")
@ -90,7 +90,6 @@ add_custom_command(
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/include
${FONTCONFIG_PKGCONFIG_INCLUDE_DIRS}
) )
link_libraries( link_libraries(
@ -139,7 +138,7 @@ target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_
target_link_libraries(looking-glass-client target_link_libraries(looking-glass-client
${EXE_FLAGS} ${EXE_FLAGS}
${FONTCONFIG_PKGCONFIG_LIBRARIES} PkgConfig::FONTCONFIG
lg_common lg_common
displayservers displayservers
lgmp lgmp

View File

@ -2,21 +2,18 @@ cmake_minimum_required(VERSION 3.0)
project(displayserver_Wayland LANGUAGES C) project(displayserver_Wayland LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_Wayland_PKGCONFIG REQUIRED pkg_check_modules(DISPLAYSERVER_Wayland REQUIRED IMPORTED_TARGET
wayland-client wayland-client
) )
#pkg_check_modules(DISPLAYSERVER_Wayland_OPT_PKGCONFIG set(DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES "")
#)
set(displayserver_Wayland_SHELL_SRC "") set(displayserver_Wayland_SHELL_SRC "")
if (ENABLE_LIBDECOR) if (ENABLE_LIBDECOR)
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED IMPORTED_TARGET
libdecor-0 libdecor-0
) )
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_LIBRARIES ${DISPLAYSERVER_Wayland_LIBDECOR_LIBRARIES}) list(APPEND DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES PkgConfig::DISPLAYSERVER_Wayland_LIBDECOR)
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_INCLUDE_DIRS ${DISPLAYSERVER_Wayland_LIBDECOR_INCLUDE_DIRS})
list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c) list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c)
add_compile_definitions(ENABLE_LIBDECOR) add_compile_definitions(ENABLE_LIBDECOR)
else() else()
@ -40,7 +37,7 @@ add_library(displayserver_Wayland STATIC
) )
target_link_libraries(displayserver_Wayland target_link_libraries(displayserver_Wayland
${DISPLAYSERVER_Wayland_PKGCONFIG_LIBRARIES} PkgConfig::DISPLAYSERVER_Wayland
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES} ${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES}
lg_common lg_common
) )
@ -48,8 +45,6 @@ target_link_libraries(displayserver_Wayland
target_include_directories(displayserver_Wayland target_include_directories(displayserver_Wayland
PRIVATE PRIVATE
src src
${DISPLAYSERVER_Wayland_PKGCONFIG_INCLUDE_DIRS}
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_INCLUDE_DIRS}
) )
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) 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) project(displayserver_X11 LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_X11_PKGCONFIG REQUIRED pkg_check_modules(DISPLAYSERVER_X11 REQUIRED IMPORTED_TARGET
x11 x11
xi xi
xfixes xfixes
@ -19,12 +19,11 @@ add_library(displayserver_X11 STATIC
add_definitions(-D GLX_GLXEXT_PROTOTYPES) add_definitions(-D GLX_GLXEXT_PROTOTYPES)
target_link_libraries(displayserver_X11 target_link_libraries(displayserver_X11
${DISPLAYSERVER_X11_PKGCONFIG_LIBRARIES} PkgConfig::DISPLAYSERVER_X11
lg_common lg_common
) )
target_include_directories(displayserver_X11 target_include_directories(displayserver_X11
PRIVATE PRIVATE
src src
${DISPLAYSERVER_X11_PKGCONFIG_INCLUDE_DIRS}
) )

View File

@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.0)
project(renderer_EGL LANGUAGES C CXX) project(renderer_EGL LANGUAGES C CXX)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(RENDERER_EGL_PKGCONFIG REQUIRED pkg_check_modules(RENDERER_EGL REQUIRED IMPORTED_TARGET
egl egl
gl gl
) )
pkg_check_modules(RENDERER_EGL_OPT_PKGCONFIG pkg_check_modules(RENDERER_EGL_OPT IMPORTED_TARGET
wayland-egl 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_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3)
target_link_libraries(renderer_EGL target_link_libraries(renderer_EGL
${RENDERER_EGL_PKGCONFIG_LIBRARIES} PkgConfig::RENDERER_EGL
${RENDERER_EGL_OPT_PKGCONFIG_LIBRARIES}
lg_common lg_common
cimgui cimgui
) )
if(RENDERER_EGL_OPT_FOUND)
target_link_libraries(renderer_EGL
PkgConfig::RENDERER_EGL_OPT
)
endif()
target_include_directories(renderer_EGL target_include_directories(renderer_EGL
PRIVATE PRIVATE
src src
${EGL_SHADER_INCS} ${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) project(renderer_Opengl LANGUAGES C CXX)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED pkg_check_modules(RENDERER_OPENGL REQUIRED IMPORTED_TARGET
gl gl
) )
@ -14,7 +14,7 @@ add_library(renderer_OpenGL STATIC
target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1) target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
target_link_libraries(renderer_OpenGL target_link_libraries(renderer_OpenGL
${RENDERER_OPENGL_PKGCONFIG_LIBRARIES} PkgConfig::RENDERER_OPENGL
lg_common lg_common
cimgui cimgui
@ -23,5 +23,4 @@ target_link_libraries(renderer_OpenGL
target_include_directories(renderer_OpenGL target_include_directories(renderer_OpenGL
PRIVATE PRIVATE
src src
${RENDERER_OPENGL_PKGCONFIG_INCLUDE_DIRS}
) )

View File

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