Debian Codegraph @

cmake/FindLibIntl.cmake

raw
1 # - find where dlopen and friends are located.
2 # LIBINTL_FOUND - system has dynamic linking interface available
3 # LIBINTL_INCLUDE_DIR - where dlfcn.h is located.
4 # LIBINTL_LIBRARY - libraries needed to use dlopen
5
6 include(CheckFunctionExists)
7
8 find_path(LIBINTL_INCLUDE_DIR NAMES libintl.h)
9 find_library(LIBINTL_LIBRARY NAMES intl)
10 if(LIBINTL_LIBRARY)
11 set(LIBINTL_FOUND TRUE)
12 else(LIBINTL_LIBRARY)
13 check_function_exists(dgettext LIBINTL_FOUND)
14 # If dlopen can be found without linking in dl then dlopen is part
15 # of libc, so don't need to link extra libs.
16 set(LIBINTL_LIBRARY "")
17 endif(LIBINTL_LIBRARY)
18
19 include(FindPackageHandleStandardArgs)
20 find_package_handle_standard_args(LIBINTL
21 FOUND_VAR
22 LIBINTL_FOUND
23 REQUIRED_VARS
24 LIBINTL_INCLUDE_DIR
25 )
26
27 mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY)
28
29 if(LIBINTL_FOUND AND NOT TARGET LibIntl::LibIntl)
30 if (LIBINTL_LIBRARY)
31 add_library(LibIntl::LibIntl UNKNOWN IMPORTED)
32 set_target_properties(LibIntl::LibIntl PROPERTIES
33 IMPORTED_LOCATION "${LIBINTL_LIBRARY}")
34 else()
35 add_library(LibIntl::LibIntl INTERFACE IMPORTED )
36 endif()
37 set_target_properties(LibIntl::LibIntl PROPERTIES
38 INTERFACE_INCLUDE_DIRECTORIES "${LIBINTL_INCLUDE_DIR}"
39 )
40 endif()
41