File: FindUtfcpp.cmake

package info (click to toggle)
ledger 3.1.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,464 kB
  • sloc: cpp: 37,495; python: 4,279; perl: 1,319; sh: 475; lisp: 436; makefile: 134; cs: 118; yacc: 103
file content (31 lines) | stat: -rw-r--r-- 748 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
# - Try to find utfcpp
# Once done, this will define
#
#  UTFCPP_FOUND        - system has utfcpp's utf8.h
#  UTFCPP_PATH         - the utfcpp include directories

include(CheckCXXSourceCompiles)

set(UTFCPP_FOUND FALSE)

find_path(UTFCPP_INCLUDE_DIR
    NAMES utf8.h
    HINTS "${UTFCPP_PATH}"
    PATHS "${PROJECT_SOURCE_DIR}/lib/utfcpp/v2_0/source"
)

if (UTFCPP_INCLUDE_DIR)
  set(CMAKE_REQUIRED_INCLUDES "${UTFCPP_INCLUDE_DIR}")
  set(UTFCPP_FOUND TRUE)
endif()

check_cxx_source_compiles("
#include <string>
#include \"utf8.h\"

int main(int argc, char** argv) {
    std::string input = std::string(\"utfcpp\");
    const char * p = input.c_str();
    std::size_t len = input.length();
    utf8::is_valid(p, p + len);
}" HAVE_WORKING_UTFCPP)