| 1 | # libConfuse is a configuration file parser library |
| 2 | # available at http://www.nongnu.org/confuse/ |
| 3 | # |
| 4 | # The module defines the following variables: |
| 5 | # CONFUSE_FOUND - the system has Confuse |
| 6 | # CONFUSE_INCLUDE_DIR - where to find confuse.h |
| 7 | # CONFUSE_INCLUDE_DIRS - confuse includes |
| 8 | # CONFUSE_LIBRARY - where to find the Confuse library |
| 9 | # CONFUSE_LIBRARIES - aditional libraries |
| 10 | # CONFUSE_ROOT_DIR - root dir (ex. /usr/local) |
| 11 | |
| 12 | #============================================================================= |
| 13 | # Copyright 2010-2013, Julien Schueller |
| 14 | # All rights reserved. |
| 15 | # |
| 16 | # Redistribution and use in source and binary forms, with or without |
| 17 | # modification, are permitted provided that the following conditions are met: |
| 18 | # |
| 19 | # 1. Redistributions of source code must retain the above copyright notice, this |
| 20 | # list of conditions and the following disclaimer. |
| 21 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
| 22 | # this list of conditions and the following disclaimer in the documentation |
| 23 | # and/or other materials provided with the distribution. |
| 24 | # |
| 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 26 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 27 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 28 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 29 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 30 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 32 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 33 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 34 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 | |
| 36 | # The views and conclusions contained in the software and documentation are those |
| 37 | # of the authors and should not be interpreted as representing official policies, |
| 38 | # either expressed or implied, of the FreeBSD Project. |
| 39 | #============================================================================= |
| 40 | |
| 41 | |
| 42 | find_path ( CONFUSE_INCLUDE_DIR |
| 43 | NAMES confuse.h |
| 44 | ) |
| 45 | |
| 46 | set ( CONFUSE_INCLUDE_DIRS ${CONFUSE_INCLUDE_DIR} ) |
| 47 | |
| 48 | find_library ( CONFUSE_LIBRARY |
| 49 | NAMES confuse |
| 50 | ) |
| 51 | |
| 52 | set ( CONFUSE_LIBRARIES ${CONFUSE_LIBRARY} ) |
| 53 | |
| 54 | |
| 55 | # try to guess root dir from include dir |
| 56 | if ( CONFUSE_INCLUDE_DIR ) |
| 57 | string ( REGEX REPLACE "(.*)/include.*" "\\1" CONFUSE_ROOT_DIR ${CONFUSE_INCLUDE_DIR} ) |
| 58 | # try to guess root dir from library dir |
| 59 | elseif ( CONFUSE_LIBRARY ) |
| 60 | string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" CONFUSE_ROOT_DIR ${CONFUSE_LIBRARY} ) |
| 61 | endif () |
| 62 | |
| 63 | |
| 64 | # handle the QUIETLY and REQUIRED arguments |
| 65 | include ( FindPackageHandleStandardArgs ) |
| 66 | find_package_handle_standard_args( Confuse DEFAULT_MSG CONFUSE_LIBRARY CONFUSE_INCLUDE_DIR ) |
| 67 | |
| 68 | mark_as_advanced ( |
| 69 | CONFUSE_LIBRARY |
| 70 | CONFUSE_LIBRARIES |
| 71 | CONFUSE_INCLUDE_DIR |
| 72 | CONFUSE_INCLUDE_DIRS |
| 73 | CONFUSE_ROOT_DIR |
| 74 | ) |