Warning, /frameworks/ki18n/cmake/FindLibIntl.cmake is written in an unsupported language. File is not indexed.
0001 #.rst:
0002 # FindLibIntl
0003 # ---------
0004 #
0005 # Find libintl
0006 #
0007 # Find the libintl headers and libraries. On platforms that use glibc this is not required
0008 # and LibIntl_LIBRARIES will be empty
0009 #
0010 # ::
0011 #
0012 # LibIntl_INCLUDE_DIRS - where to find libintl.h
0013 # LibIntl_LIBRARIES - The libintl library if the current platform does not use glibc.
0014 # LibIntl_FOUND - True if libintl was found.
0015
0016 #=============================================================================
0017 # SPDX-FileCopyrightText: 2014 Alex Richardson <arichardson.kde@gmail.com>
0018 #
0019 # SPDX-License-Identifier: BSD-3-Clause
0020 #=============================================================================
0021
0022 find_path(LibIntl_INCLUDE_DIRS NAMES libintl.h)
0023 find_library(LibIntl_LIBRARIES NAMES intl libintl)
0024
0025 include(CheckCXXSymbolExists)
0026 include(CMakePushCheckState)
0027 check_cxx_symbol_exists(dngettext libintl.h LibIntl_SYMBOL_FOUND)
0028
0029 include(FindPackageHandleStandardArgs)
0030 if(LibIntl_SYMBOL_FOUND)
0031 message(STATUS "libintl is part of libc, no extra library is required.")
0032 set(LibIntl_LIBRARIES "")
0033 if(LibIntl_INCLUDE_DIRS)
0034 find_package_handle_standard_args(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS)
0035 else()
0036 # in the default search path but not found by find_path, e.g. host glibc when cross-compiling
0037 set(LibIntl_INCLUDE_DIRS "")
0038 set(LibIntl_FOUND TRUE)
0039 endif()
0040 else()
0041 message(STATUS "libintl is a separate library.")
0042 find_package_handle_standard_args(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS LibIntl_LIBRARIES)
0043 endif()
0044
0045 # make sure we have -Wl,--no-undefined here, otherwise this test will always pass
0046 cmake_push_check_state()
0047 set(CMAKE_REQUIRED_LIBRARIES ${LibIntl_LIBRARIES} ${CMAKE_SHARED_LINKER_FLAGS})
0048 check_cxx_source_compiles("extern \"C\" int _nl_msg_cat_cntr; int main(void) { ++_nl_msg_cat_cntr; return 0; }" HAVE_NL_MSG_CAT_CNTR)
0049 cmake_pop_check_state()