~ubuntu-branches/ubuntu/precise/stellarium/precise

« back to all changes in this revision

Viewing changes to plugins/LogBook/cmake/FindIconv.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Scott Howard
  • Date: 2010-02-15 20:48:39 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100215204839-u3qgbv60rho997yk
Tags: 0.10.3-0ubuntu1
* New upstream release.
  - fixes intel rendering bug (LP: #480553)

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
  PATHS 
 
18
  /opt/local/include
 
19
  /sw/include
 
20
  /usr/include 
 
21
 
22
 
 
23
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv c
 
24
  PATHS 
 
25
  /opt/local/lib
 
26
  /sw/lib
 
27
  /usr/lib
 
28
  ) 
 
29
 
 
30
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) 
 
31
   SET(ICONV_FOUND TRUE) 
 
32
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) 
 
33
 
 
34
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
 
35
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
 
36
IF(ICONV_FOUND)
 
37
  check_cxx_source_compiles("
 
38
  #include <iconv.h>
 
39
  int main(){
 
40
    iconv_t conv = 0;
 
41
    const char* in = 0;
 
42
    size_t ilen = 0;
 
43
    char* out = 0;
 
44
    size_t olen = 0;
 
45
    iconv(conv, &in, &ilen, &out, &olen);
 
46
    return 0;
 
47
  }
 
48
" ICONV_SECOND_ARGUMENT_IS_CONST )
 
49
ENDIF(ICONV_FOUND)
 
50
set(CMAKE_REQUIRED_INCLUDES)
 
51
set(CMAKE_REQUIRED_LIBRARIES)
 
52
 
 
53
IF(ICONV_FOUND) 
 
54
  IF(NOT ICONV_FIND_QUIETLY) 
 
55
    MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") 
 
56
  ENDIF(NOT ICONV_FIND_QUIETLY) 
 
57
ELSE(ICONV_FOUND) 
 
58
  IF(Iconv_FIND_REQUIRED) 
 
59
    MESSAGE(FATAL_ERROR "Could not find Iconv") 
 
60
  ENDIF(Iconv_FIND_REQUIRED) 
 
61
ENDIF(ICONV_FOUND) 
 
62
 
 
63
MARK_AS_ADVANCED(
 
64
  ICONV_INCLUDE_DIR
 
65
  ICONV_LIBRARIES
 
66
  ICONV_SECOND_ARGUMENT_IS_CONST
 
67
)
 
 
b'\\ No newline at end of file'