File: FindYAML.cmake

package info (click to toggle)
lammps 20250204%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 474,368 kB
  • sloc: cpp: 1,060,070; python: 27,785; ansic: 8,956; f90: 7,254; sh: 6,044; perl: 4,171; fortran: 2,442; xml: 1,714; makefile: 1,352; objc: 238; lisp: 188; yacc: 58; csh: 16; awk: 14; tcl: 6; javascript: 2
file content (30 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# - Find libyaml
# Find the native Yaml headers and libraries.
#
#  YAML_INCLUDE_DIRS - where to find yaml.h
#  YAML_LIBRARIES    - List of libraries when using libyaml
#  YAML_FOUND        - True if libyaml is found.
#

find_path(YAML_INCLUDE_DIR yaml.h PATH_SUFFIXES yaml)
find_library(YAML_LIBRARY NAMES yaml)

# handle the QUIET and REQUIRED arguments and
# set YAML_FOUND to TRUE if all variables are non-zero
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(YAML DEFAULT_MSG YAML_LIBRARY YAML_INCLUDE_DIR)

# Copy the results to the output variables and target.
if(YAML_FOUND)
  set(YAML_LIBRARIES ${YAML_LIBRARY})
  set(YAML_INCLUDE_DIRS ${YAML_INCLUDE_DIR})

  if(NOT TARGET Yaml::Yaml)
    add_library(Yaml::Yaml UNKNOWN IMPORTED)
    set_target_properties(Yaml::Yaml PROPERTIES
      IMPORTED_LOCATION "${YAML_LIBRARY}"
      INTERFACE_INCLUDE_DIRECTORIES "${YAML_INCLUDE_DIR}")
  endif()
endif()

mark_as_advanced(YAML_INCLUDE_DIR YAML_LIBRARY)