Files @ daeb6dfc9a9f
Branch filter:

Location: libtransport.git/backends/libcommuni/CMakeLists.txt

Conrad Kostecki
Enable support for Qt5

Since Qt4 is EOL, we should also support libcommuni build with Qt5.
In order not to break Fedora docker builds, -DENABLE_QT4 is introduced.

When set to 'ON', support for Qt4 is being enabled,
otherwise support for Qt5 is enabled.

Signed-off-by: Conrad Kostecki <conrad@kostecki.com>
cmake_minimum_required(VERSION 2.6)
FILE(GLOB SRC *.cpp)
FILE(GLOB HEADERS *.h)

if (ENABLE_QT4)
	QT4_WRAP_CPP(SRC ${HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
else()
	QT5_WRAP_CPP(SRC ${HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
	include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
endif()

add_definitions(-DQT_NO_KEYWORDS)
ADD_EXECUTABLE(spectrum2_libcommuni_backend ${SRC})

if (NOT WIN32)
	if (ENABLE_QT4)
		target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt4::QtNetwork Qt4::QtCore transport pthread)
	else()
		target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt5::Network Qt5::Core transport pthread)
	endif()
else ()
	if (ENABLE_QT4)
		target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt4::QtNetwork Qt4::QtCore transport)
	else()
		target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt5::Network Qt5::Core transport)
	endif()
endif()
INSTALL(TARGETS spectrum2_libcommuni_backend RUNTIME DESTINATION bin)