File: FindLibIntl.cmake

package info (click to toggle)
fcitx5 5.1.18-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 32,228 kB
  • sloc: cpp: 110,377; java: 3,125; javascript: 2,137; sh: 1,912; xml: 1,552; python: 1,312; ansic: 843; makefile: 11
file content (41 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (11)
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
# - find where dlopen and friends are located.
# LibIntl_FOUND - system has dynamic linking interface available
# LibIntl_INCLUDE_DIR - where dlfcn.h is located.
# LibIntl_LIBRARY - libraries needed to use dlopen

include(CheckFunctionExists)

find_path(LibIntl_INCLUDE_DIR NAMES libintl.h)
find_library(LibIntl_LIBRARY NAMES intl)
if(LibIntl_LIBRARY)
  set(LibIntl_FOUND TRUE)
else(LibIntl_LIBRARY)
  check_function_exists(dgettext LibIntl_FOUND)
  # If dlopen can be found without linking in dl then dlopen is part
  # of libc, so don't need to link extra libs.
  set(LibIntl_LIBRARY "")
endif(LibIntl_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibIntl
    FOUND_VAR
        LibIntl_FOUND
    REQUIRED_VARS
        LibIntl_INCLUDE_DIR
)

mark_as_advanced(LibIntl_INCLUDE_DIR LibIntl_LIBRARY)

if(LibIntl_FOUND AND NOT TARGET LibIntl::LibIntl)
    if (LibIntl_LIBRARY)
        add_library(LibIntl::LibIntl UNKNOWN IMPORTED)
        set_target_properties(LibIntl::LibIntl PROPERTIES
            IMPORTED_LOCATION "${LibIntl_LIBRARY}")
    else()
        add_library(LibIntl::LibIntl INTERFACE IMPORTED )
    endif()
    set_target_properties(LibIntl::LibIntl PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${LibIntl_INCLUDE_DIR}"
    )
endif()