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