From 89450b7e117237b5b72dad1ed8e2de41592662fb Mon Sep 17 00:00:00 2001 From: Scott Giese Date: Sun, 22 Mar 2020 17:46:50 -0500 Subject: [PATCH] Improve PkgConfig usage Including FindPkgConfig directly into scripts is not a recommended practice. Doing so will cause CMake to complain with a warning. Replaced with find_package(PkgConfig QUIET) --- CMakeModules/FindGTA.cmake | 8 ++------ CMakeModules/FindGtkGl.cmake | 5 +---- CMakeModules/FindPoppler-glib.cmake | 5 +---- CMakeModules/FindRSVG.cmake | 6 +----- src/osgViewer/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/CMakeModules/FindGTA.cmake b/CMakeModules/FindGTA.cmake index e483ad3c5..87c6259e3 100644 --- a/CMakeModules/FindGTA.cmake +++ b/CMakeModules/FindGTA.cmake @@ -8,14 +8,10 @@ # correspond to the ./configure --prefix=$GTA_DIR # used in building libgta. -INCLUDE(FindPkgConfig OPTIONAL) +find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) - - INCLUDE(FindPkgConfig) - PKG_CHECK_MODULES(GTA gta) - ENDIF(PKG_CONFIG_FOUND) IF(NOT GTA_FOUND) @@ -54,4 +50,4 @@ IF(NOT GTA_FOUND) SET(GTA_FOUND "YES") ENDIF(GTA_LIBRARIES AND GTA_INCLUDE_DIRS) -ENDIF(NOT GTA_FOUND) \ No newline at end of file +ENDIF(NOT GTA_FOUND) diff --git a/CMakeModules/FindGtkGl.cmake b/CMakeModules/FindGtkGl.cmake index 321cede6c..83ee41ba6 100644 --- a/CMakeModules/FindGtkGl.cmake +++ b/CMakeModules/FindGtkGl.cmake @@ -1,10 +1,7 @@ #use pkg-config to find various modues -INCLUDE(FindPkgConfig OPTIONAL) +find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) - - INCLUDE(FindPkgConfig) - PKG_CHECK_MODULES(GTK gtk+-2.0) IF(WIN32) diff --git a/CMakeModules/FindPoppler-glib.cmake b/CMakeModules/FindPoppler-glib.cmake index d89a186f2..8716fb899 100644 --- a/CMakeModules/FindPoppler-glib.cmake +++ b/CMakeModules/FindPoppler-glib.cmake @@ -1,10 +1,7 @@ #use pkg-config to find various modues -INCLUDE(FindPkgConfig OPTIONAL) +find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) - - INCLUDE(FindPkgConfig) - PKG_CHECK_MODULES(CAIRO cairo) PKG_CHECK_MODULES(POPPLER poppler-glib) diff --git a/CMakeModules/FindRSVG.cmake b/CMakeModules/FindRSVG.cmake index 8d219ff21..df1cedacb 100644 --- a/CMakeModules/FindRSVG.cmake +++ b/CMakeModules/FindRSVG.cmake @@ -1,10 +1,7 @@ #use pkg-config to find various modues -INCLUDE(FindPkgConfig OPTIONAL) +find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) - - INCLUDE(FindPkgConfig) - #Version 2.35 introduces the rsvg_cleanup function which is used PKG_CHECK_MODULES(RSVG librsvg-2.0>=2.35) @@ -14,5 +11,4 @@ IF(PKG_CONFIG_FOUND) SET(RSVG_FOUND FALSE) ENDIF() - ENDIF() diff --git a/src/osgViewer/CMakeLists.txt b/src/osgViewer/CMakeLists.txt index 415789fea..aac4bbba4 100644 --- a/src/osgViewer/CMakeLists.txt +++ b/src/osgViewer/CMakeLists.txt @@ -185,7 +185,7 @@ ELSE() ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "X11") # X11 for everybody else - INCLUDE(FindPkgConfig OPTIONAL) + find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(XRANDR xrandr)