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 | |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 35 | if(LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS) |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 36 | # in cache already |
| 37 | set(LIBVAL_FOUND TRUE) |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 38 | else() |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 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 |
Michal Vasko | 5a290c8 | 2016-02-25 14:45:10 +0100 | [diff] [blame] | 59 | val-threads |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 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 |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 69 | ) |
| 70 | |
Michal Vasko | 5a290c8 | 2016-02-25 14:45:10 +0100 | [diff] [blame] | 71 | find_library(LIBSRES_LIBRARY |
| 72 | NAMES |
| 73 | libsres |
| 74 | sres |
| 75 | PATHS |
| 76 | /usr/lib |
| 77 | /usr/lib64 |
| 78 | /usr/local/lib |
| 79 | /usr/local/lib64 |
| 80 | /opt/local/lib |
| 81 | /sw/lib |
| 82 | ${CMAKE_LIBRARY_PATH} |
| 83 | ${CMAKE_INSTALL_PREFIX}/lib |
| 84 | ) |
| 85 | |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 86 | if(LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY AND LIBSRES_LIBRARY) |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 87 | set(LIBVAL_FOUND TRUE) |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 88 | else() |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 89 | set(LIBVAL_FOUND FALSE) |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 90 | endif() |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 91 | |
| 92 | set(LIBVAL_INCLUDE_DIRS ${LIBVAL_INCLUDE_DIR}) |
Michal Vasko | 5a290c8 | 2016-02-25 14:45:10 +0100 | [diff] [blame] | 93 | set(LIBVAL_LIBRARIES ${LIBSRES_LIBRARY} ${LIBVAL_LIBRARY}) |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 94 | |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 95 | include(FindPackageHandleStandardArgs) |
Michal Vasko | dbd97df | 2021-05-26 12:04:16 +0200 | [diff] [blame] | 96 | find_package_handle_standard_args(LibVAL DEFAULT_MSG LIBVAL_LIBRARIES LIBVAL_INCLUDE_DIRS) |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 97 | |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 98 | # show the LIBVAL_INCLUDE_DIRS and LIBVAL_LIBRARIES variables only in the advanced view |
| 99 | mark_as_advanced(LIBVAL_INCLUDE_DIRS LIBVAL_LIBRARIES) |
| 100 | |
Claus Klein | 2209191 | 2020-01-20 13:45:47 +0100 | [diff] [blame] | 101 | endif() |
Michal Vasko | 3d865d2 | 2016-01-28 16:00:53 +0100 | [diff] [blame] | 102 | |