File: Findccd.cmake

package info (click to toggle)
dart 6.12.1%2Bdfsg4-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,000 kB
  • sloc: cpp: 269,461; python: 3,911; xml: 1,273; sh: 404; makefile: 30
file content (71 lines) | stat: -rw-r--r-- 1,786 bytes parent folder | download
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright (c) 2011-2021, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
#   https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the "BSD-style" License

# Find CCD
#
# This sets the following variables:
#   CCD_FOUND
#   CCD_INCLUDE_DIRS
#   CCD_LIBRARIES
#   CCD_VERSION
#
# and the following targets:
#   ccd

find_package(ccd QUIET CONFIG)
# Upstream provide ccd-config.cmake since 2.1.

if(NOT CCD_FOUND AND NOT ccd_FOUND)

  find_package(PkgConfig QUIET)

  # Check to see if pkgconfig is installed.
  pkg_check_modules(PC_CCD ccd QUIET)

  # Include directories
  # Give explicit precedence to ${PC_CCD_INCLUDEDIR}
  find_path(CCD_INCLUDE_DIRS
      NAMES ccd/ccd.h
      HINTS ${PC_CCD_INCLUDEDIR}
      NO_DEFAULT_PATH
      NO_CMAKE_PATH
      NO_CMAKE_ENVIRONMENT_PATH
      NO_SYSTEM_ENVIRONMENT_PATH)
  find_path(CCD_INCLUDE_DIRS
      NAMES ccd/ccd.h
      HINTS ${PC_CCD_INCLUDEDIR}
      PATHS "${CMAKE_INSTALL_PREFIX}/include")

  # Libraries
  if(MSVC)
    set(CCD_LIBRARIES "ccd$<$<CONFIG:Debug>:d>")
  else()
    # Give explicit precedence to ${PC_CCD_LIBDIR}
    find_library(CCD_LIBRARIES
        NAMES ccd
        HINTS ${PC_CCD_LIBDIR}
        NO_DEFAULT_PATH
        NO_CMAKE_PATH
        NO_CMAKE_ENVIRONMENT_PATH
        NO_SYSTEM_ENVIRONMENT_PATH)
    find_library(CCD_LIBRARIES
        NAMES ccd
        HINTS ${PC_CCD_LIBDIR})
  endif()

  # Version
  set(CCD_VERSION ${PC_CCD_VERSION})

  # Set (NAME)_FOUND if all the variables and the version are satisfied.
  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(ccd
      FAIL_MESSAGE  DEFAULT_MSG
      REQUIRED_VARS CCD_INCLUDE_DIRS CCD_LIBRARIES
      VERSION_VAR   CCD_VERSION)

endif()