Warning, /multimedia/k3b/cmake/modules/FindIconv.cmake is written in an unsupported language. File is not indexed.

0001 # This file is part of Strigi Desktop Search
0002 #
0003 # SPDX-FileCopyrightText: 2006 Jos van den Oever <jos@vandenoever.info>
0004 #
0005 # SPDX-License-Identifier: LGPL-2.0-or-later
0006 
0007 # - Try to find Iconv 
0008 # Once done this will define 
0009 # 
0010 #  ICONV_FOUND - system has Iconv 
0011 #  ICONV_INCLUDE_DIR - the Iconv include directory 
0012 #  ICONV_LIBRARIES - Link these to use Iconv 
0013 #  ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
0014 # 
0015 include(CheckCXXSourceCompiles)
0016 
0017 if(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
0018   # Already in cache, be silent
0019   set(ICONV_FIND_QUIETLY TRUE)
0020 endif()
0021 
0022 find_path(ICONV_INCLUDE_DIR iconv.h)
0023  
0024 find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
0025 
0026 include(FindPackageHandleStandardArgs)
0027 find_package_handle_standard_args(Iconv DEFAULT_MSG ICONV_INCLUDE_DIR ICONV_LIBRARIES)
0028  
0029 if(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
0030    set(ICONV_FOUND TRUE)
0031 ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) 
0032 
0033 set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
0034 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
0035 IF(ICONV_FOUND)
0036   check_cxx_source_compiles("
0037   #include <iconv.h>
0038   int main(){
0039     iconv_t conv = 0;
0040     const char* in = 0;
0041     size_t ilen = 0;
0042     char* out = 0;
0043     size_t olen = 0;
0044     iconv(conv, &in, &ilen, &out, &olen);
0045     return 0;
0046   }
0047 " ICONV_SECOND_ARGUMENT_IS_CONST )
0048 ENDIF(ICONV_FOUND)
0049 set(CMAKE_REQUIRED_INCLUDES)
0050 set(CMAKE_REQUIRED_LIBRARIES)
0051 
0052 IF(ICONV_FOUND) 
0053   IF(NOT ICONV_FIND_QUIETLY) 
0054     MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") 
0055   ENDIF(NOT ICONV_FIND_QUIETLY) 
0056 ELSE(ICONV_FOUND) 
0057   IF(Iconv_FIND_REQUIRED) 
0058     MESSAGE(FATAL_ERROR "Could not find Iconv") 
0059   ENDIF(Iconv_FIND_REQUIRED) 
0060 ENDIF(ICONV_FOUND) 
0061 
0062 MARK_AS_ADVANCED(
0063   ICONV_INCLUDE_DIR
0064   ICONV_LIBRARIES
0065   ICONV_SECOND_ARGUMENT_IS_CONST
0066 )