CMake: Find more external libraries

Check for LibNotify, MSpack, XTest and GnomeVFS2.
This commit is contained in:
Maarten Bent
2018-12-11 20:49:14 +01:00
parent 79344fc5b6
commit 14570b4fa3
8 changed files with 304 additions and 2 deletions

View File

@@ -0,0 +1,90 @@
# - Try to find GnomeVFS2
# Once done this will define
#
# GNOMEVFS2_FOUND - system has GnomeVFS2
# GNOMEVFS2_INCLUDE_DIRS - the GnomeVFS2 include directory
# GNOMEVFS2_LIBRARIES - Link these to use GnomeVFS2
# GNOMEVFS2_DEFINITIONS - Compiler switches required for using GnomeVFS2
#
# Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)
# in cache already
set(GNOMEVFS2_FOUND TRUE)
else (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(gnome-vfs-2.0 _GNOMEVFS2_INCLUDEDIR _GNOMEVFS2_LIBDIR _GNOMEVFS2_LDFLAGS _GNOMEVFS2_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_GNOMEVFS2 gnome-vfs-2.0)
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_path(GNOMEVFS2_INCLUDE_DIR
NAMES
libgnomevfs/gnome-vfs.h
PATHS
${_GNOMEVFS2_INCLUDEDIR}
/usr/include
/usr/local/include
/opt/local/include
/sw/include
$ENV{DEVLIBS_PATH}//include//
PATH_SUFFIXES
gnome-vfs-2.0
)
find_library(GNOMEVFS-2_LIBRARY
NAMES
gnomevfs-2
PATHS
${_GNOMEVFS2_LIBDIR}
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
if (GNOMEVFS-2_LIBRARY)
set(GNOMEVFS-2_FOUND TRUE)
endif (GNOMEVFS-2_LIBRARY)
set(GNOMEVFS2_INCLUDE_DIRS
${GNOMEVFS2_INCLUDE_DIR}
)
if (GNOMEVFS-2_FOUND)
set(GNOMEVFS2_LIBRARIES
${GNOMEVFS2_LIBRARIES}
${GNOMEVFS-2_LIBRARY}
)
endif (GNOMEVFS-2_FOUND)
if (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES)
set(GNOMEVFS2_FOUND TRUE)
endif (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES)
if (GNOMEVFS2_FOUND)
if (NOT GnomeVFS2_FIND_QUIETLY)
message(STATUS "Found GnomeVFS2: ${GNOMEVFS2_LIBRARIES}")
endif (NOT GnomeVFS2_FIND_QUIETLY)
else (GNOMEVFS2_FOUND)
if (GnomeVFS2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GnomeVFS2")
endif (GnomeVFS2_FIND_REQUIRED)
endif (GNOMEVFS2_FOUND)
# show the GNOMEVFS2_INCLUDE_DIRS and GNOMEVFS2_LIBRARIES variables only in the advanced view
mark_as_advanced(GNOMEVFS2_INCLUDE_DIRS GNOMEVFS2_LIBRARIES)
endif (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)

View File

@@ -0,0 +1,55 @@
# - Try to find LibNotify
# This module defines the following variables:
#
# LIBNOTIFY_FOUND - LibNotify was found
# LIBNOTIFY_INCLUDE_DIRS - the LibNotify include directories
# LIBNOTIFY_LIBRARIES - link these to use LibNotify
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
# Copyright (C) 2014 Collabora Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_package(PkgConfig)
pkg_check_modules(LIBNOTIFY QUIET libnotify)
find_path(LIBNOTIFY_INCLUDE_DIRS
NAMES notify.h
HINTS ${LIBNOTIFY_INCLUDEDIR}
${LIBNOTIFY_INCLUDE_DIRS}
PATH_SUFFIXES libnotify
)
find_library(LIBNOTIFY_LIBRARIES
NAMES notify
HINTS ${LIBNOTIFY_LIBDIR}
${LIBNOTIFY_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibNotify REQUIRED_VARS LIBNOTIFY_INCLUDE_DIRS LIBNOTIFY_LIBRARIES
VERSION_VAR LIBNOTIFY_VERSION)
mark_as_advanced(
LIBNOTIFY_INCLUDE_DIRS
LIBNOTIFY_LIBRARIES
)

View File

@@ -0,0 +1,40 @@
## FindMSPACK.cmake
##
## Copyright (C) 2016 Christian Schenk
##
## This file is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; either version 2, or (at your
## option) any later version.
##
## This file is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this file; if not, write to the Free Software
## Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
find_path(MSPACK_INCLUDE_DIR
NAMES
mspack.h
)
find_library(MSPACK_LIBRARY
NAMES
mspack
)
find_package_handle_standard_args(MSPACK DEFAULT_MSG MSPACK_LIBRARY MSPACK_INCLUDE_DIR)
if(MSPACK_FOUND)
set(MSPACK_INCLUDE_DIRS ${MSPACK_INCLUDE_DIR})
set(MSPACK_LIBRARIES ${MSPACK_LIBRARY})
else()
set(MSPACK_INCLUDE_DIRS)
set(MSPACK_LIBRARIES)
endif()
mark_as_advanced(MSPACK_LIBRARY MSPACK_INCLUDE_DIR)

View File

@@ -0,0 +1,51 @@
# - Find XTEST
# Find the XTEST libraries
#
# This module defines the following variables:
# XTEST_FOUND - true if XTEST_INCLUDE_DIR & XTEST_LIBRARY are found
# XTEST_LIBRARIES - Set when XTEST_LIBRARY is found
# XTEST_INCLUDE_DIRS - Set when XTEST_INCLUDE_DIR is found
#
# XTEST_INCLUDE_DIR - where to find XTest.h, etc.
# XTEST_LIBRARY - the XTEST library
#
#=============================================================================
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XTest include directory"
)
find_library(XTEST_LIBRARY NAMES Xtst
PATHS /opt/X11/lib
DOC "The XTest library"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XTest DEFAULT_MSG XTEST_LIBRARY XTEST_INCLUDE_DIR)
if(XTEST_FOUND)
set( XTEST_LIBRARIES ${XTEST_LIBRARY} )
set( XTEST_INCLUDE_DIRS ${XTEST_INCLUDE_DIR} )
endif()
mark_as_advanced(XTEST_INCLUDE_DIR XTEST_LIBRARY)