forked from win-iconv/win-iconv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (70 loc) · 2.65 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
project(win_iconv)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
set(CPACK_GENERATOR "TBZ2")
include(CPack)
option(BUILD_TEST "build test executable" OFF)
if(WINCE)
option(BUILD_STATIC "build the static library" ON)
option(BUILD_SHARED "build the shared library" OFF)
option(BUILD_EXECUTABLE "build the win_iconv executable" OFF)
else(WINCE)
option(BUILD_STATIC "build the static library" OFF)
option(BUILD_SHARED "build the shared library" ON)
option(BUILD_EXECUTABLE "build the win_iconv executable" ON)
endif(WINCE)
if(BUILD_TEST)
enable_testing()
endif(BUILD_TEST)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
if(NOT WINCE)
add_definitions(-DUSE_LIBICONV_DLL)
if(DEFAULT_LIBICONV_DLL)
add_definitions(-DDEFAULT_LIBICONV_DLL=${DEFAULT_LIBICONV_DLL})
endif(DEFAULT_LIBICONV_DLL)
else(NOT WINCE)
find_package(Wcecompat REQUIRED)
include_directories(${WCECOMPAT_INCLUDE_DIR})
endif(NOT WINCE)
if(BUILD_SHARED)
add_library(iconv SHARED win_iconv.c iconv.def)
set_target_properties(iconv PROPERTIES COMPILE_FLAGS "-DMAKE_DLL"
PREFIX "")
if(WINCE)
target_link_libraries(iconv ${WCECOMPAT_LIBRARIES})
endif(WINCE)
install(TARGETS iconv RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(BUILD_SHARED)
if(BUILD_EXECUTABLE)
add_executable(win_iconv win_iconv.c)
set_target_properties(win_iconv PROPERTIES COMPILE_FLAGS "-DMAKE_EXE")
if(WINCE)
target_link_libraries(win_iconv ${WCECOMPAT_LIBRARIES})
endif(WINCE)
install(TARGETS win_iconv RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(BUILD_EXECUTABLE)
if(BUILD_STATIC)
add_library(iconv-static STATIC win_iconv.c)
set_target_properties(iconv-static PROPERTIES OUTPUT_NAME "iconv")
if(WINCE)
target_link_libraries(iconv-static ${WCECOMPAT_LIBRARIES})
endif(WINCE)
install(TARGETS iconv-static RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(BUILD_STATIC)
install(FILES iconv.h DESTINATION include)
if(BUILD_TEST)
# tests:
add_executable(win_iconv_test win_iconv_test.c)
add_test(win_iconv_test win_iconv_test)
if(WINCE)
target_link_libraries(win_iconv_test ${WCECOMPAT_LIBRARIES})
endif(WINCE)
endif(BUILD_TEST)