1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
7 SET(${PROJECT_NAME}SharedTarget osgiconv)
8 SET(${PROJECT_NAME}StaticTarget libosgiconv)
10 SET(OSGLibIconvLibSrcDir ${OSGLibIconvSrcDir} CACHE PATH "")
12 IF(EXISTS ${OSGLibIconvSrcDir}/source)
13 SET(OSGLibIconvSrcDir ${OSGLibIconvSrcDir}/source CACHE PATH "" FORCE)
14 ELSEIF(EXISTS ${OSGLibIconvSrcDir}/src/libiconv/1.9.2/libiconv-1.9.2)
15 SET(OSGLibIconvLibSrcDir ${OSGLibIconvSrcDir}/src/libiconv/1.9.2/libiconv-1.9.2-src CACHE PATH "" FORCE)
16 SET(OSGLibIconvSrcDir ${OSGLibIconvSrcDir}/src/libiconv/1.9.2/libiconv-1.9.2 CACHE PATH "" FORCE)
19 SET(OSG_LIBICONV_SRCS ${OSGLibIconvLibSrcDir}/lib/iconv.c
20 ${OSGLibIconvLibSrcDir}/libcharset/lib/localcharset.c
21 ${OSGLibIconvLibSrcDir}/lib/relocatable.c)
23 IF(NOT EXISTS ${OSGLibIconvSrcDir}/include/iconv.h)
26 COMMAND "${CMAKE_COMMAND}" -E copy_if_different
27 "${CMAKE_CURRENT_SOURCE_DIR}/iconv.h"
28 "${CMAKE_BINARY_DIR}/libiconv/include/iconv.h")
31 COMMAND "${CMAKE_COMMAND}" -E copy_if_different
32 "${CMAKE_CURRENT_SOURCE_DIR}/config.h"
33 "${CMAKE_BINARY_DIR}/libiconv/config.h")
36 COMMAND "${CMAKE_COMMAND}" -E copy_if_different
37 "${CMAKE_CURRENT_SOURCE_DIR}/localcharset.h"
38 "${CMAKE_BINARY_DIR}/libiconv/localcharset.h")
41 SET(OSG_LIBICONV_HDR ${CMAKE_BINARY_DIR}/libiconv/include/iconv.h)
43 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/libiconv/include)
44 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/libiconv)
48 SET(OSG_LIBICONV_HDR ${OSGLibIconvSrcDir}/include/iconv.h)
53 SET(OSGLIBICONV_DEF _UNICODE;UNICODE;relocate=libiconv_relocate;set_relocation_prefix=libiconv_set_relocation_prefix;HAVE_CONFIG_H;ENABLE_RELOCATABLE=1;IN_LIBRARY;NO_XMALLOC;INSTALLPREFIX="${CMAKE_INSTALL_PREFIX}";INSTALLDIR="${CMAKE_INSTALL_PREFIX}";LIBDIR="${CMAKE_INSTALL_PREFIX}")
55 INCLUDE_DIRECTORIES(${OSGLibIconvSrcDir})
56 INCLUDE_DIRECTORIES(${OSGLibIconvSrcDir}/lib)
57 INCLUDE_DIRECTORIES(${OSGLibIconvSrcDir}/libcharset/include)
58 INCLUDE_DIRECTORIES(${OSGLibIconvSrcDir}/include)
61 ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED ${OSG_LIBICONV_SRCS})
63 ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}SharedTarget})
65 SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
68 SET(OSGLIBICONV_DEF_SHARED ${OSGLIBICONV_DEF};BUILDING_LIBICONV;BUILDING_DLL;PIC;)
70 SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
71 COMPILE_DEFINITIONS "${OSGLIBICONV_DEF_SHARED}")
73 INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
74 CONFIGURATIONS Release
75 RUNTIME DESTINATION bin COMPONENT release_runtimes
76 LIBRARY DESTINATION lib COMPONENT release_libraries
77 ARCHIVE DESTINATION lib COMPONENT release_libraries)
79 INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
81 RUNTIME DESTINATION bin COMPONENT debug_runtimes
82 LIBRARY DESTINATION lib COMPONENT debug_libraries
83 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
85 ENDIF(BUILD_SHARED_LIBS)
88 ADD_LIBRARY(${${PROJECT_NAME}StaticTarget} STATIC ${OSG_LIBICONV_SRCS})
90 ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}StaticTarget})
92 SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES
95 SET_TARGET_PROPERTIES(${${PROJECT_NAME}StaticTarget} PROPERTIES
96 COMPILE_DEFINITIONS "${OSGLIBICONV_DEF}")
99 INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
100 CONFIGURATIONS Release
101 RUNTIME DESTINATION lib COMPONENT release_libraries
102 LIBRARY DESTINATION lib COMPONENT release_libraries
103 ARCHIVE DESTINATION lib COMPONENT release_libraries)
105 INSTALL(TARGETS ${${PROJECT_NAME}StaticTarget}
107 RUNTIME DESTINATION lib COMPONENT debug_libraries
108 LIBRARY DESTINATION lib COMPONENT debug_libraries
109 ARCHIVE DESTINATION lib COMPONENT debug_libraries)
110 ENDIF(BUILD_STATIC_LIBS)
112 INSTALL(FILES ${OSG_LIBICONV_HDR}
113 DESTINATION include${OSG_SUPPORT_INC_SUBDIR}
114 COMPONENT code_headers
115 PERMISSIONS OWNER_WRITE OWNER_READ
119 IF(NOT EXISTS ${OSGLibIconvSrcDir}/include/iconv.h)
120 SET(OSG_ICONV_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libiconv/include CACHE PATH "" FORCE)
122 SET(OSG_ICONV_INCLUDE_DIR ${OSGLibIconvSrcDir}/include CACHE PATH "" FORCE)
125 SET(OSG_ICONV_STATIC_LIBRARY ${${PROJECT_NAME}StaticTarget} CACHE STRING "" FORCE)
126 SET(OSG_ICONV_SHARED_LIBRARY ${${PROJECT_NAME}SharedTarget} CACHE STRING "" FORCE)
128 ELSE(OSGLibIconvSrcDir)
129 SET(OSGLibIconvSrcDir "" CACHE PATH "")
130 ENDIF(OSGLibIconvSrcDir)