File: FindStringView.cmake

package info (click to toggle)
genomicsdb 1.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 24,788 kB
  • sloc: cpp: 78,988; ansic: 58,119; java: 8,531; python: 2,270; sh: 1,850; perl: 1,621; makefile: 490; xml: 455
file content (33 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (2)
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
# Once done this will define
# STRING_VIEW_FOUND if string_view found

include(CheckCXXSourceCompiles)
set(STRING_VIEW_SRC
  "
  #include <string_view>
  int main() {
    std::string_view(\"qwerty\");
    return 0;
  }
  "
  )
set(STRING_VIEW_EXPERIMENTAL_SRC
  "
  #include <experimental/string_view>
  int main() {
    std::experimental::string_view(\"qwerty\");
    return 0;
  }
  "
  )
check_cxx_source_compiles("${STRING_VIEW_SRC}" STRING_VIEW_FOUND)
if(NOT STRING_VIEW_FOUND)
  check_cxx_source_compiles("${STRING_VIEW_EXPERIMENTAL_SRC}" STRING_VIEW_EXPERIMENTAL_FOUND)
  if(STRING_VIEW_EXPERIMENTAL_FOUND)
    message(STATUS "experimental/string_view found")
    add_definitions(-DSTRING_VIEW_EXPERIMENTAL_FOUND=1)
  endif()
else()
  message(STATUS "string_view found")
  add_definitions(-DSTRING_VIEW_FOUND=1)
endif()