diff -r 3c02a728a681 -r 53c2aecb9704 CMakeLists.txt --- a/CMakeLists.txt Wed May 27 21:44:42 2015 +0300 +++ b/CMakeLists.txt Thu Jul 23 00:16:47 2015 +0300 @@ -1,6 +1,7 @@ cmake_minimum_required (VERSION 2.4) cmake_policy (SET CMP0003 NEW) -project (zfc9000) +project (ZFC9000) +string (TOLOWER ${CMAKE_PROJECT_NAME} TARGET_NAME) add_library (huffman STATIC huffman/bitreader.cpp @@ -22,31 +23,54 @@ sources/network/udpsocket.cpp ) -set (CURSES_NEED_NCURSES, True) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall") +set (HEADER_FILES + sources/basics.h + sources/coloredline.h + sources/geometry.h + sources/interface.h + sources/list.h + sources/main.h + sources/md5.h + sources/mystring.h + sources/network/bytestream.h + sources/network/ipaddress.h + sources/network/rconsession.h + sources/network/udpsocket.h + sources/range.h + sources/version.h +) if (NOT WIN32) - find_package (Curses) + find_package (Curses REQUIRED) endif() if (MINGW) set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") endif() -include_directories (${CURSES_INCUDE_DIRS}) include_directories (${CMAKE_CURRENT_BINARY_DIR}) include_directories (huffman) -add_executable (${PROJECT_NAME} ${SOURCE_FILES}) -target_link_libraries (${PROJECT_NAME} huffman) +add_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) +target_link_libraries (${TARGET_NAME} huffman) + +if (WIN32) + add_definitions ("/Za /D_CRT_SEURE_NO_WARNINGS") -if (NOT WIN32) - target_link_libraries (${PROJECT_NAME} ${CURSES_LIBRARIES}) + if (NOT PDCURSES_WIN32A_PATH) + message (SEND_ERROR "Must give PDCURSES_WIN32A_PATH on Windows") + else() + include_directories (${PDCURSES_WIN32A_PATH}/include) + target_link_libraries (${TARGET_NAME} ${PDCURSES_WIN32A_PATH}/lib/pdcurses.a) + target_link_libraries (${TARGET_NAME} wsock32 ws2_32) + endif() else() - target_link_libraries (${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR}/pdcurses.a wsock32 ws2_32) + include_directories (${CURSES_INCUDE_DIRS}) # sic + target_link_libraries (${TARGET_NAME} ${CURSES_LIBRARIES}) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -std=c++0x") endif() add_custom_target (make_hginfo_h COMMAND python "${CMAKE_SOURCE_DIR}/updaterevision/updaterevision.py" "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h") -add_dependencies (${PROJECT_NAME} make_hginfo_h) +add_dependencies (${TARGET_NAME} make_hginfo_h)