blob: 507bf8a38ca75c39ad876a30c4eee76b384fb98d [file] [log] [blame]
Michal Vasko3d865d22016-01-28 16:00:53 +01001# - 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
35if (LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS)
36 # in cache already
37 set(LIBVAL_FOUND TRUE)
38else (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
Michal Vasko5a290c82016-02-25 14:45:10 +010059 val-threads
Michal Vasko3d865d22016-01-28 16:00:53 +010060 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 Vasko3d865d22016-01-28 16:00:53 +010069 )
70
Michal Vasko5a290c82016-02-25 14:45:10 +010071 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
86 if (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY AND LIBSRES_LIBRARY)
Michal Vasko3d865d22016-01-28 16:00:53 +010087 set(LIBVAL_FOUND TRUE)
Michal Vasko5a290c82016-02-25 14:45:10 +010088 else (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY AND LIBSRES_LIBRARY)
Michal Vasko3d865d22016-01-28 16:00:53 +010089 set(LIBVAL_FOUND FALSE)
Michal Vasko5a290c82016-02-25 14:45:10 +010090 endif (LIBVAL_INCLUDE_DIR AND LIBVAL_LIBRARY AND LIBSRES_LIBRARY)
Michal Vasko3d865d22016-01-28 16:00:53 +010091
92 set(LIBVAL_INCLUDE_DIRS ${LIBVAL_INCLUDE_DIR})
Michal Vasko5a290c82016-02-25 14:45:10 +010093 set(LIBVAL_LIBRARIES ${LIBSRES_LIBRARY} ${LIBVAL_LIBRARY})
Michal Vasko3d865d22016-01-28 16:00:53 +010094
95 # show the LIBVAL_INCLUDE_DIRS and LIBVAL_LIBRARIES variables only in the advanced view
96 mark_as_advanced(LIBVAL_INCLUDE_DIRS LIBVAL_LIBRARIES)
97
98endif (LIBVAL_LIBRARIES AND LIBVAL_INCLUDE_DIRS)
99