LibYAMLConfig.cmake (1584B)
1 # Copyright (C) 2015-2016 CNRS 2 # 3 # This program is free software: you can redistribute it and/or modify 4 # it under the terms of the GNU General Public License as published by 5 # the Free Software Foundation, either version 3 of the License, or 6 # (at your option) any later version. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 cmake_minimum_required(VERSION 2.8) 17 18 # Try to find the LibYAML devel. Once done this will define: 19 # - LibYAML_FOUND: system has LibYAML 20 # - LibYAML_INCLUDE_DIR: the include directory 21 # - LibYAML: Link this to use LibYAML 22 23 find_path(LibYAML_INCLUDE_DIR yaml.h) 24 unset(LibYAML_LIBRARY CACHE) 25 unset(LibYAML_LIBRARY_DEBUG CACHE) 26 unset(LibYAML_LIBRARY_RELWITHDEBINFO CACHE) 27 unset(LibYAML_LIBRARY_MINSIZEREL CACHE) 28 find_library(LibYAML_LIBRARY yaml DOC "Path to library yaml.") 29 30 # Create the imported library target 31 if(CMAKE_HOST_WIN32) 32 set(_property IMPORTED_IMPLIB) 33 else(CMAKE_HOST_WIN32) 34 set(_property IMPORTED_LOCATION) 35 endif(CMAKE_HOST_WIN32) 36 add_library(LibYAML SHARED IMPORTED) 37 set_target_properties(LibYAML PROPERTIES ${_property} ${LibYAML_LIBRARY}) 38 39 # Check the package 40 include(FindPackageHandleStandardArgs) 41 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibYAML DEFAULT_MSG 42 LibYAML_INCLUDE_DIR 43 LibYAML_LIBRARY) 44