CMakeLists.txt

changeset 87
53c2aecb9704
parent 83
08bfc3d9d2ae
child 88
08ccaf26cffd
equal deleted inserted replaced
86:3c02a728a681 87:53c2aecb9704
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 add_definitions ("/Za /D_CRT_SEURE_NO_WARNINGS")
58
59 if (NOT PDCURSES_WIN32A_PATH)
60 message (SEND_ERROR "Must give PDCURSES_WIN32A_PATH on Windows")
61 else()
62 include_directories (${PDCURSES_WIN32A_PATH}/include)
63 target_link_libraries (${TARGET_NAME} ${PDCURSES_WIN32A_PATH}/lib/pdcurses.a)
64 target_link_libraries (${TARGET_NAME} wsock32 ws2_32)
65 endif()
44 else() 66 else()
45 target_link_libraries (${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR}/pdcurses.a wsock32 ws2_32) 67 include_directories (${CURSES_INCUDE_DIRS}) # sic
68 target_link_libraries (${TARGET_NAME} ${CURSES_LIBRARIES})
69 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=c++0x")
46 endif() 70 endif()
47 71
48 add_custom_target (make_hginfo_h 72 add_custom_target (make_hginfo_h
49 COMMAND python 73 COMMAND python
50 "${CMAKE_SOURCE_DIR}/updaterevision/updaterevision.py" 74 "${CMAKE_SOURCE_DIR}/updaterevision/updaterevision.py"
51 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h") 75 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h")
52 add_dependencies (${PROJECT_NAME} make_hginfo_h) 76 add_dependencies (${TARGET_NAME} make_hginfo_h)

mercurial