summary refs log tree commit diff
path: root/cmake/Findcmark.cmake
blob: 6f3e72a33bfd85a833524bde26ce83825f726de6 (plain) (blame)
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
#
# CMake module to search for the cmark library
#

find_package(PkgConfig)
pkg_check_modules(PC_CMARK QUIET cmark)

if(NOT CMARK_INCLUDE_DIR)
  find_path(CMARK_INCLUDE_DIR
            NAMES cmark.h
            PATHS ${PC_CMARK_INCLUDEDIR}
                  ${PC_CMARK_INCLUDE_DIRS}
                  /usr/include
                  /usr/local/include)
endif()

if(NOT CMARK_LIBRARY)
  find_library(CMARK_LIBRARY
               NAMES cmark
               HINTS ${PC_CMARK_LIBDIR}
                     ${PC_CMARK_LIBRARY_DIRS}
                     /usr/lib
                     /usr/local/lib)
endif()

if(NOT TARGET cmark::cmark)
  add_library(cmark::cmark UNKNOWN IMPORTED)
  set_target_properties(cmark::cmark
                        PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                   ${CMARK_INCLUDE_DIR})
  set_property(TARGET cmark::cmark APPEND
               PROPERTY IMPORTED_LOCATION ${CMARK_LIBRARY})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cmark
  REQUIRED_VARS CMARK_LIBRARY CMARK_INCLUDE_DIR
)

mark_as_advanced(CMARK_LIBRARY CMARK_INCLUDE_DIR)

set(CMARK_LIBRARIES ${CMARK_LIBRARY})
set(CMARK_INCLUDE_DIRS ${CMARK_INCLUDE_DIR})