CMakeLists.txt

branch
protocol5
changeset 106
7b156b764d11
parent 97
2d43f05b284c
child 163
5948441a1951
equal deleted inserted replaced
104:a76af67a3a4b 106:7b156b764d11
1 cmake_minimum_required (VERSION 2.4) 1 cmake_minimum_required (VERSION 2.4)
2 cmake_policy (SET CMP0003 NEW) 2 cmake_policy (SET CMP0003 NEW)
3 project (zfc9000) 3 project (ZFC9000)
4 string (TOLOWER ${CMAKE_PROJECT_NAME} TARGET_NAME)
4 5
5 add_library (huffman STATIC 6 add_library (huffman STATIC
6 huffman/bitreader.cpp 7 huffman/bitreader.cpp
7 huffman/bitwriter.cpp 8 huffman/bitwriter.cpp
8 huffman/huffcodec.cpp 9 huffman/huffcodec.cpp
20 sources/network/ipaddress.cpp 21 sources/network/ipaddress.cpp
21 sources/network/rconsession.cpp 22 sources/network/rconsession.cpp
22 sources/network/udpsocket.cpp 23 sources/network/udpsocket.cpp
23 ) 24 )
24 25
25 set (CURSES_NEED_NCURSES, True) 26 set (HEADER_FILES
26 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall") 27 sources/basics.h
28 sources/coloredline.h
29 sources/geometry.h
30 sources/interface.h
31 sources/list.h
32 sources/main.h
33 sources/md5.h
34 sources/mystring.h
35 sources/network/bytestream.h
36 sources/network/ipaddress.h
37 sources/network/rconsession.h
38 sources/network/udpsocket.h
39 sources/range.h
40 sources/version.h
41 )
27 42
28 if (NOT WIN32) 43 if (NOT WIN32)
29 find_package (Curses) 44 find_package (Curses REQUIRED)
30 endif() 45 endif()
31 46
32 if (MINGW) 47 if (MINGW)
33 set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") 48 set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
34 endif() 49 endif()
35 50
36 include_directories (${CURSES_INCUDE_DIRS})
37 include_directories (${CMAKE_CURRENT_BINARY_DIR}) 51 include_directories (${CMAKE_CURRENT_BINARY_DIR})
38 include_directories (huffman) 52 include_directories (huffman)
39 add_executable (${PROJECT_NAME} ${SOURCE_FILES}) 53 add_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES})
40 target_link_libraries (${PROJECT_NAME} huffman) 54 target_link_libraries (${TARGET_NAME} huffman)
41 55
42 if (NOT WIN32) 56 if (WIN32)
43 target_link_libraries (${PROJECT_NAME} ${CURSES_LIBRARIES}) 57 if (PDCURSES_PATH OR PDCURSES_WIN32A_PATH)
58 if (NOT PDCURSES_PATH)
59 set (PDCURSES_PATH "${PDCURSES_WIN32A_PATH}")
60 add_definitions (-DHAVE_PDCURSES_WIN32A)
61 message (STATUS "Using external PDCurses-win32a in ${PDCURSES_WIN32A_PATH}")
62 else()
63 message (STATUS "Using external PDCurses in ${PDCURSES_PATH}")
64 endif()
65
66 include_directories (${PDCURSES_PATH}/include)
67
68 if (MINGW)
69 target_link_libraries (${TARGET_NAME} ${PDCURSES_PATH}/lib/pdcurses.a)
70 else()
71 target_link_libraries (${TARGET_NAME} ${PDCURSES_PATH}/lib/pdcurses.lib)
72 endif()
73 else()
74 add_library (pdcurses STATIC
75 pdcurses/addch.c
76 pdcurses/addchstr.c
77 pdcurses/addstr.c
78 pdcurses/attr.c
79 pdcurses/beep.c
80 pdcurses/bkgd.c
81 pdcurses/border.c
82 pdcurses/clear.c
83 pdcurses/color.c
84 pdcurses/debug.c
85 pdcurses/delch.c
86 pdcurses/deleteln.c
87 pdcurses/deprec.c
88 pdcurses/getch.c
89 pdcurses/getstr.c
90 pdcurses/getyx.c
91 pdcurses/inch.c
92 pdcurses/inchstr.c
93 pdcurses/initscr.c
94 pdcurses/inopts.c
95 pdcurses/insch.c
96 pdcurses/insstr.c
97 pdcurses/instr.c
98 pdcurses/kernel.c
99 pdcurses/keyname.c
100 pdcurses/mouse.c
101 pdcurses/move.c
102 pdcurses/outopts.c
103 pdcurses/overlay.c
104 pdcurses/pad.c
105 pdcurses/panel.c
106 pdcurses/pdcclip.c
107 pdcurses/pdcdisp.c
108 pdcurses/pdcgetsc.c
109 pdcurses/pdckbd.c
110 pdcurses/pdcscrn.c
111 pdcurses/pdcsetsc.c
112 pdcurses/pdcutil.c
113 pdcurses/printw.c
114 pdcurses/refresh.c
115 pdcurses/scanw.c
116 pdcurses/scroll.c
117 pdcurses/scr_dump.c
118 pdcurses/slk.c
119 pdcurses/termattr.c
120 pdcurses/terminfo.c
121 pdcurses/touch.c
122 pdcurses/util.c
123 pdcurses/window.c
124 )
125 target_link_libraries (${TARGET_NAME} pdcurses)
126 message (STATUS "Using internal pdcurses")
127 endif()
128
129 add_definitions (-D_CRT_SECURE_NO_WARNINGS)
130 target_link_libraries (${TARGET_NAME} wsock32 ws2_32)
131 include_directories (pdcurses)
44 else() 132 else()
45 target_link_libraries (${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR}/pdcurses.a wsock32 ws2_32) 133 include_directories (${CURSES_INCUDE_DIRS}) # sic
134 target_link_libraries (${TARGET_NAME} ${CURSES_LIBRARIES})
135 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=c++0x")
46 endif() 136 endif()
47 137
48 add_custom_target (make_hginfo_h 138 add_custom_target (make_hginfo_h
49 COMMAND python 139 COMMAND python
50 "${CMAKE_SOURCE_DIR}/updaterevision/updaterevision.py" 140 "${CMAKE_SOURCE_DIR}/updaterevision/updaterevision.py"
51 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h") 141 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h")
52 add_dependencies (${PROJECT_NAME} make_hginfo_h) 142 add_dependencies (${TARGET_NAME} make_hginfo_h)

mercurial