Warning, /office/kexi/cmake/modules/FindIconv.cmake is written in an unsupported language. File is not indexed.
0001 # - Try to find Iconv
0002 # Once done this will define
0003 #
0004 # Iconv_FOUND - system has Iconv
0005 # ICONV_INCLUDE_DIR - the Iconv include directory
0006 # ICONV_LIBRARIES - Link these to use Iconv
0007 # ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
0008 #
0009
0010 include(CheckCXXSourceCompiles)
0011 include(FeatureSummary)
0012 set_package_properties(Iconv
0013 PROPERTIES DESCRIPTION "A library to convert between different character encodings"
0014 URL "https://www.gnu.org/software/libiconv")
0015
0016 if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
0017 # Already in cache, be silent
0018 set(Iconv_FIND_QUIETLY TRUE)
0019 endif ()
0020
0021 find_path(ICONV_INCLUDE_DIR iconv.h)
0022
0023 find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
0024
0025 if(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
0026 set(Iconv_FOUND TRUE)
0027 endif()
0028
0029 set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
0030 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
0031 if(Iconv_FOUND)
0032 check_cxx_source_compiles("
0033 #include <iconv.h>
0034 int main(){
0035 iconv_t conv = 0;
0036 const char* in = 0;
0037 size_t ilen = 0;
0038 char* out = 0;
0039 size_t olen = 0;
0040 iconv(conv, &in, &ilen, &out, &olen);
0041 return 0;
0042 }
0043 " ICONV_SECOND_ARGUMENT_IS_CONST )
0044 endif()
0045 set(CMAKE_REQUIRED_INCLUDES)
0046 set(CMAKE_REQUIRED_LIBRARIES)
0047
0048 if(Iconv_FOUND)
0049 if(NOT Iconv_FIND_QUIETLY)
0050 message(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
0051 endif()
0052 else()
0053 if(Iconv_FIND_REQUIRED)
0054 message(FATAL_ERROR "Could not find Iconv")
0055 endif()
0056 endif()
0057
0058 # Did we find anything?
0059 include(FindPackageHandleStandardArgs)
0060 find_package_handle_standard_args(Iconv REQUIRED_VARS ICONV_INCLUDE_DIR ICONV_LIBRARIES)
0061
0062 mark_as_advanced(
0063 ICONV_INCLUDE_DIR
0064 ICONV_LIBRARIES
0065 ICONV_SECOND_ARGUMENT_IS_CONST
0066 )