OpenSceneGraph/CMakeModules/FindPoppler-glib.cmake
Scott Giese 89450b7e11 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)
2020-03-22 17:46:50 -05:00

39 lines
851 B
CMake

#use pkg-config to find various modues
find_package(PkgConfig QUIET)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(CAIRO cairo)
PKG_CHECK_MODULES(POPPLER poppler-glib)
IF (POPPLER_FOUND)
INCLUDE(CheckCXXSourceRuns)
SET(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIRS})
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
#include <poppler.h>
int main()
{
#ifdef POPPLER_HAS_CAIRO
return EXIT_SUCCESS;
#else
return EXIT_FAILURE
#endif
}
" POPPLER_HAS_CAIRO)
IF (NOT POPPLER_HAS_CAIRO)
SET(POPPLER_FOUND FALSE)
ENDIF()
ENDIF()
# IF (POPPLER_FOUND AND (NOT POPPLER_LIBRARIES OR NOT POPPLER_INCLUDE_DIRS) )
# SET(POPPLER_FOUND FALSE)
# ENDIF()
ENDIF()