Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 1 | # - Try to find LibVAL |
| 2 | # Once done this will define |
| 3 | # |
| 4 | # LIBVAL_FOUND - system has LibVAL |
| 5 | # LIBVAL_INCLUDE_DIRS - the LibVAL include directory |
| 6 | # LIBVAL_LIBRARIES - link these to use LibVAL |
| 7 | # |
| 8 | # Author Michal Vasko <mvasko@cesnet.cz> |
| 9 | # Copyright (c) 2015 CESNET, z.s.p.o. |
| 10 | # |
| 11 | # Redistribution and use in source and binary forms, with or without |
| 12 | # modification, are permitted provided that the following conditions |
| 13 | # are met: |
| 14 | # |
| 15 | # 1. Redistributions of source code must retain the copyright |
| 16 | # notice, this list of conditions and the following disclaimer. |
| 17 | # 2. Redistributions in binary form must reproduce the copyright |
| 18 | # notice, this list of conditions and the following disclaimer in the |
| 19 | # documentation and/or other materials provided with the distribution. |
| 20 | # 3. The name of the author may not be used to endorse or promote products |
| 21 | # derived from this software without specific prior written permission. |
| 22 | # |
| 23 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 24 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 25 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 26 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 27 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 28 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 32 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 | # |
| 34 | |
| 35 | if (LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS) |
| 36 | # in cache already |
| 37 | set(LIBVAL_FOUND TRUE) |
| 38 | else (LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS) |
| 39 | |
| 40 | find_path(LIBVAL_INCLUDE_DIR |
| 41 | NAMES |
| 42 | validator/validator.h |
| 43 | validator/resolver.h |
| 44 | validator/validator-compat.h |
| 45 | validator/val_dane.h |
| 46 | validator/val_errors.h |
| 47 | PATHS |
| 48 | /usr/include |
| 49 | /usr/local/include |
| 50 | /opt/local/include |
| 51 | /sw/include |
| 52 | ${CMAKE_INCLUDE_PATH} |
| 53 | ${CMAKE_INSTALL_PREFIX}/include |
| 54 | ) |
| 55 | |
| 56 | find_library(LIBVAL_LIBRARY |
| 57 | NAMES |
| 58 | libval-threads |
| 59 | libsres |
| 60 | PATHS |
| 61 | /usr/lib |
| 62 | /usr/lib64 |
| 63 | /usr/local/lib |
| 64 | /usr/local/lib64 |
| 65 | /opt/local/lib |
| 66 | /sw/lib |
| 67 | ${CMAKE_LIBRARY_PATH} |
| 68 | ${CMAKE_INSTALL_PREFIX}/lib |
| 69 | NAMES_PER_DIR |
| 70 | ) |
| 71 | |
| 72 | if (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY) |
| 73 | set(LIBVAL_FOUND TRUE) |
| 74 | else (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY) |
| 75 | set(LIBVAL_FOUND FALSE) |
| 76 | endif (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY) |
| 77 | |
| 78 | set(LIBVAL_INCLUDE_DIRS ${LIBVAL_INCLUDE_DIR}) |
| 79 | set(LIBVAL_LIBRARIES ${LIBVAL_LIBRARY}) |
| 80 | |
| 81 | # show the LIBVAL_INCLUDE_DIRS and LIBVAL_LIBRARIES variables only in the advanced view |
| 82 | mark_as_advanced(LIBVAL_INCLUDE_DIRS LIBVAL_LIBRARIES) |
| 83 | |
| 84 | endif (LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS) |
| 85 | |