spectrum2/cmake_modules/glibConfig.cmake

62 lines
1.9 KiB
CMake
Raw Permalink Normal View History

2011-03-24 09:16:02 +01:00
set(GLIB2_LIBRARIES "GLIB2_LIBRARIES-NOTFOUND")
if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
# Already in cache, be silent
set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
if (NOT WIN32)
find_package(PkgConfig REQUIRED)
2011-05-20 10:28:33 +02:00
pkg_check_modules(PKG_GLIB glib-2.0)
2011-03-24 09:16:02 +01:00
endif(NOT WIN32)
find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
PATH_SUFFIXES glib-2.0
PATHS ${PKG_GLIB_INCLUDE_DIRS} )
# search the glibconfig.h include dir under the same root where the library is found
find_library(GLIB2_LIBRARIES
NAMES glib-2.0
PATHS ${PKG_GLIB_LIBRARY_DIRS} )
find_library(GLIB2_THREAD
NAMES gthread-2.0
PATHS ${PKG_GLIB_LIBRARY_DIRS} )
find_library(GLIB2_OBJECT
NAMES gobject-2.0
PATHS ${PKG_GLIB_LIBRARY_DIRS} )
find_library(GLIB2_MODULE
NAMES gmodule-2.0
PATHS ${PKG_GLIB_LIBRARY_DIRS} )
2011-03-24 09:16:02 +01:00
find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
PATH_SUFFIXES glib-2.0/include
PATHS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_LIBRARIES} ${CMAKE_SYSTEM_LIBRARY_PATH})
if(GLIB2_THREAD)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${GLIB2_THREAD} ${GLIB2_MODULE} ${GLIB2_OBJECT})
2011-03-24 09:16:02 +01:00
else(GLIB2_THREAD)
2011-05-20 10:21:18 +02:00
message( STATUS "Could NOT find gthread-2.0" )
2011-03-24 09:16:02 +01:00
endif(GLIB2_THREAD)
set(GLIB2_INCLUDE_DIR ${GLIB2_MAIN_INCLUDE_DIR})
# not sure if this include dir is optional or required
# for now it is optional
if(GLIB2_INTERNAL_INCLUDE_DIR)
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR})
set(GLIB2_FOUND TRUE)
endif(GLIB2_INTERNAL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
2015-11-19 15:19:14 +01:00
if (WIN32)
2012-09-08 12:57:22 +03:00
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "../lib/glib-2.0/include")
2015-11-19 15:19:14 +01:00
else()
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR})
endif()
2012-09-08 12:57:22 +03:00
2011-03-24 09:16:02 +01:00
mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)