~ubuntu-branches/debian/jessie/stellarium/jessie

« back to all changes in this revision

Viewing changes to cmake/FindIconv.cmake

Tags: upstream-0.9.0
Import upstream version 0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - Try to find Iconv 
 
2
# Once done this will define 
 
3
 
4
#  ICONV_FOUND - system has Iconv 
 
5
#  ICONV_INCLUDE_DIR - the Iconv include directory 
 
6
#  ICONV_LIBRARIES - Link these to use Iconv 
 
7
#  ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
 
8
 
9
include(CheckCXXSourceCompiles)
 
10
 
 
11
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
 
12
  # Already in cache, be silent
 
13
  SET(ICONV_FIND_QUIETLY TRUE)
 
14
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
 
15
 
 
16
FIND_PATH(ICONV_INCLUDE_DIR iconv.h 
 
17
  /usr/include 
 
18
  /usr/local/include 
 
19
 
20
 
 
21
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv c
 
22
  PATHS 
 
23
  /usr/lib/
 
24
  /usr/local/lib
 
25
  ) 
 
26
 
 
27
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) 
 
28
   SET(ICONV_FOUND TRUE) 
 
29
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) 
 
30
 
 
31
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
 
32
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
 
33
IF(ICONV_FOUND)
 
34
  check_cxx_source_compiles("
 
35
  #include <iconv.h>
 
36
  int main(){
 
37
    iconv_t conv = 0;
 
38
    const char* in = 0;
 
39
    size_t ilen = 0;
 
40
    char* out = 0;
 
41
    size_t olen = 0;
 
42
    iconv(conv, &in, &ilen, &out, &olen);
 
43
    return 0;
 
44
  }
 
45
" ICONV_SECOND_ARGUMENT_IS_CONST )
 
46
ENDIF(ICONV_FOUND)
 
47
set(CMAKE_REQUIRED_INCLUDES)
 
48
set(CMAKE_REQUIRED_LIBRARIES)
 
49
 
 
50
IF(ICONV_FOUND) 
 
51
  IF(NOT ICONV_FIND_QUIETLY) 
 
52
    MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") 
 
53
  ENDIF(NOT ICONV_FIND_QUIETLY) 
 
54
ELSE(ICONV_FOUND) 
 
55
  IF(Iconv_FIND_REQUIRED) 
 
56
    MESSAGE(FATAL_ERROR "Could not find Iconv") 
 
57
  ENDIF(Iconv_FIND_REQUIRED) 
 
58
ENDIF(ICONV_FOUND) 
 
59
 
 
60
MARK_AS_ADVANCED(
 
61
  ICONV_INCLUDE_DIR
 
62
  ICONV_LIBRARIES
 
63
  ICONV_SECOND_ARGUMENT_IS_CONST
 
64
)
 
 
b'\\ No newline at end of file'