Michal Vasko | 97a8f57 | 2016-02-17 14:02:15 +0100 | [diff] [blame^] | 1 | # - Try to find LibYANG |
| 2 | # Once done this will define |
| 3 | # |
| 4 | # LIBYANG_FOUND - system has LibYANG |
| 5 | # LIBYANG_INCLUDE_DIRS - the LibYANG include directory |
| 6 | # LIBYANG_LIBRARIES - Link these to use LibSSH |
| 7 | # |
| 8 | # Author Radek Krejci <rkrejci@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 (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS) |
| 36 | # in cache already |
| 37 | set(LIBYANG_FOUND TRUE) |
| 38 | else (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS) |
| 39 | |
| 40 | find_path(LIBYANG_INCLUDE_DIR |
| 41 | NAMES |
| 42 | libyang/libyang.h |
| 43 | PATHS |
| 44 | /usr/include |
| 45 | /usr/local/include |
| 46 | /opt/local/include |
| 47 | /sw/include |
| 48 | ${CMAKE_INCLUDE_PATH} |
| 49 | ${CMAKE_INSTALL_PREFIX}/include |
| 50 | ) |
| 51 | |
| 52 | find_library(LIBYANG_LIBRARY |
| 53 | NAMES |
| 54 | yang |
| 55 | libyang |
| 56 | PATHS |
| 57 | /usr/lib |
| 58 | /usr/lib64 |
| 59 | /usr/local/lib |
| 60 | /usr/local/lib64 |
| 61 | /opt/local/lib |
| 62 | /sw/lib |
| 63 | ${CMAKE_LIBRARY_PATH} |
| 64 | ${CMAKE_INSTALL_PREFIX}/lib |
| 65 | ) |
| 66 | |
| 67 | if (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY) |
| 68 | set(LIBYANG_FOUND TRUE) |
| 69 | else (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY) |
| 70 | set(LIBYANG_FOUND FALSE) |
| 71 | endif (LIBYANG_INCLUDE_DIR AND LIBYANG_LIBRARY) |
| 72 | |
| 73 | set(LIBYANG_INCLUDE_DIRS ${LIBYANG_INCLUDE_DIR}) |
| 74 | set(LIBYANG_LIBRARIES ${LIBYANG_LIBRARY}) |
| 75 | |
| 76 | # show the LIBYANG_INCLUDE_DIRS and LIBYANG_LIBRARIES variables only in the advanced view |
| 77 | mark_as_advanced(LIBYANG_INCLUDE_DIRS LIBYANG_LIBRARIES) |
| 78 | |
| 79 | endif (LIBYANG_LIBRARIES AND LIBYANG_INCLUDE_DIRS) |
| 80 | |