From 3ddd72318be7119768b9b471c283aedd7d616048 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> Date: Wed, 18 Jan 2012 20:43:39 +0100 Subject: [PATCH 09/11] Add a FindFlightCrew.cmake cmake module --- src/FlightCrew/CMakeLists.txt | 1 + src/FlightCrew/FindFlightCrew.cmake | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) create mode 100644 src/FlightCrew/FindFlightCrew.cmake diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt index 9214c85..a294b7f 100644 --- a/src/FlightCrew/CMakeLists.txt +++ b/src/FlightCrew/CMakeLists.txt @@ -148,4 +148,5 @@ if( UNIX AND NOT APPLE ) file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/Validators/*.h" ) install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}/Validators ) install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../XercesExtensions/NodeLocationInfo.h DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} ) + install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindFlightCrew.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/${PROJECT_NAME} ) endif() diff --git a/src/FlightCrew/FindFlightCrew.cmake b/src/FlightCrew/FindFlightCrew.cmake new file mode 100644 index 0000000..d0f5102 --- /dev/null +++ b/src/FlightCrew/FindFlightCrew.cmake @@ -0,0 +1,49 @@ +# Try to find the FlightCrew lib +# Once done this will define: +# +# FLIGHTCREW_FOUND - system has FlightCrew +# FLIGHTCREW_INCLUDE_DIRS - the FlightCrew include directory +# FLIGHTCREW_LIBRARIES - The libraries needed to use FlightCrew +# +# Copyright (c) 2011, Dan HorĂ¡k <dan[at]danny.cz> +# Copyright (c) 2012, Hans de Goede <hdegoede@redhat.com> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (FLIGHTCREW_INCLUDE_DIRS) + # Already in cache, be silent + set(FLIGHTCREW_FIND_QUIETLY TRUE) +endif (FLIGHTCREW_INCLUDE_DIRS) + +#FIND_PATH(FLIGHTCREW_INCLUDE_DIRS flightcrew.h) + +if( NOT FLIGHTCREW_INCLUDE_DIRS ) + find_path(FLIGHTCREW_INCLUDE_DIRS flightcrew.h PATH_SUFFIXES FlightCrew) + #now flightcrew.h was inside a FlightCrew subdirectory so we need to + #add that to the include dir + set(FLIGHTCREW_INCLUDE_DIRS ${FLIGHTCREW_INCLUDE_DIRS}/FlightCrew CACHE PATH "FlightCrew include directory") +endif( NOT FLIGHTCREW_INCLUDE_DIRS ) + + +FIND_LIBRARY(FLIGHTCREW_LIBRARIES NAMES FlightCrew) + +if (FLIGHTCREW_INCLUDE_DIRS AND FLIGHTCREW_LIBRARIES) + set(FLIGHTCREW_FOUND TRUE) +endif (FLIGHTCREW_INCLUDE_DIRS AND FLIGHTCREW_LIBRARIES) + + +if (FLIGHTCREW_FOUND) + if (NOT FLIGHTCREW_FIND_QUIETLY) + message(STATUS "Found FlightCrew: ${FLIGHTCREW_LIBRARIES}") + endif (NOT FLIGHTCREW_FIND_QUIETLY) +else (FLIGHTCREW_FOUND) + if (FLIGHTCREW_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find FlightCrew") + else (FLIGHTCREW_FIND_REQUIRED) + message(STATUS "Could NOT find FlightCrew") + endif (FLIGHTCREW_FIND_REQUIRED) +endif (FLIGHTCREW_FOUND) + +MARK_AS_ADVANCED(FLIGHTCREW_INCLUDE_DIRS FLIGHTCREW_LIBRARIES) -- 1.7.7.4