CMakeLists.txt

Sat, 23 Jul 2016 12:34:05 +0300

author
Teemu Piippo <teemu@compsta2.com>
date
Sat, 23 Jul 2016 12:34:05 +0300
branch
protocol5
changeset 169
febc3ed5435c
parent 167
0150f86e68f0
child 171
d0fba0d7ad03
permissions
-rw-r--r--

Merged with default

cmake_minimum_required (VERSION 2.4)
cmake_policy (SET CMP0003 NEW)
project (ZFC9000)
string (TOLOWER ${CMAKE_PROJECT_NAME} TARGET_NAME)

add_library (huffman STATIC
	huffman/bitreader.cpp
	huffman/bitwriter.cpp
	huffman/huffcodec.cpp
	huffman/huffman.cpp
)

set (SOURCE_FILES
	sources/coloredline.cpp
	sources/interface.cpp
	sources/list.cpp
	sources/main.cpp
	sources/md5.cpp
	sources/mystring.cpp
	sources/version.cpp
	sources/network/bytestream.cpp
	sources/network/ipaddress.cpp
	sources/network/packetqueue.cpp
	sources/network/rconsession.cpp
	sources/network/udpsocket.cpp
)

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/packetqueue.h
	sources/network/rconsession.h
	sources/network/udpsocket.h
	sources/range.h
	sources/version.h
)

if (NOT WIN32)
	find_package (Curses REQUIRED)
endif()

if (MINGW)
	set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
endif()

include_directories (${CMAKE_CURRENT_BINARY_DIR})
include_directories (huffman)
add_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries (${TARGET_NAME} huffman)

if (WIN32)
	if (PDCURSES_PATH OR PDCURSES_WIN32A_PATH)
		if (NOT PDCURSES_PATH)
			set (PDCURSES_PATH "${PDCURSES_WIN32A_PATH}")
			add_definitions (-DHAVE_PDCURSES_WIN32A)
			message (STATUS "Using external PDCurses-win32a in ${PDCURSES_WIN32A_PATH}")
		else()
			message (STATUS "Using external PDCurses in ${PDCURSES_PATH}")
		endif()

		include_directories (${PDCURSES_PATH}/include)

		if (MINGW)
			target_link_libraries (${TARGET_NAME} ${PDCURSES_PATH}/lib/pdcurses.a)
		else()
			target_link_libraries (${TARGET_NAME} ${PDCURSES_PATH}/lib/pdcurses.lib)
		endif()
	else()
		add_library (pdcurses STATIC
			pdcurses/addch.c
			pdcurses/addchstr.c
			pdcurses/addstr.c
			pdcurses/attr.c
			pdcurses/beep.c
			pdcurses/bkgd.c
			pdcurses/border.c
			pdcurses/clear.c
			pdcurses/color.c
			pdcurses/debug.c
			pdcurses/delch.c
			pdcurses/deleteln.c
			pdcurses/deprec.c
			pdcurses/getch.c
			pdcurses/getstr.c
			pdcurses/getyx.c
			pdcurses/inch.c
			pdcurses/inchstr.c
			pdcurses/initscr.c
			pdcurses/inopts.c
			pdcurses/insch.c
			pdcurses/insstr.c
			pdcurses/instr.c
			pdcurses/kernel.c
			pdcurses/keyname.c
			pdcurses/mouse.c
			pdcurses/move.c
			pdcurses/outopts.c
			pdcurses/overlay.c
			pdcurses/pad.c
			pdcurses/panel.c
			pdcurses/pdcclip.c
			pdcurses/pdcdisp.c
			pdcurses/pdcgetsc.c
			pdcurses/pdckbd.c
			pdcurses/pdcscrn.c
			pdcurses/pdcsetsc.c
			pdcurses/pdcutil.c
			pdcurses/printw.c
			pdcurses/refresh.c
			pdcurses/scanw.c
			pdcurses/scroll.c
			pdcurses/scr_dump.c
			pdcurses/slk.c
			pdcurses/termattr.c
			pdcurses/terminfo.c
			pdcurses/touch.c
			pdcurses/util.c
			pdcurses/window.c
		)
		target_link_libraries (${TARGET_NAME} pdcurses)
		message (STATUS "Using internal pdcurses")
	endif()

	add_definitions (-D_CRT_SECURE_NO_WARNINGS)
	target_link_libraries (${TARGET_NAME} wsock32 ws2_32)
	include_directories (pdcurses)
else()
	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 (${TARGET_NAME} make_hginfo_h)

mercurial