CMakeLists.txt

Sat, 06 Jun 2015 22:28:34 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jun 2015 22:28:34 +0300
changeset 43
1394901b557a
parent 42
9528f8d06962
child 44
d0bf58f3560f
permissions
-rw-r--r--

Renamed cfg.cpp/h to config.cpp/h

project (zcinema)
cmake_minimum_required (VERSION 2.6)

if (USE_QT5)
	find_package (Qt5Widgets REQUIRED)
	find_package (Qt5Core REQUIRED)
	find_package (Qt5OpenGL REQUIRED)
	find_package (Qt5Network REQUIRED)
	set (CMAKE_AUTOMOC ON)
else()
	find_package (Qt4 REQUIRED)
endif()

include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})

set (ZCINEMA_SOURCES
	src/config.cpp
	src/configwindow.cpp
	src/demo.cpp
	src/main.cpp
	src/misc.cpp
	src/prompts.cpp
)

set (ZCINEMA_HEADERS
	src/config.h
	src/configwindow.h
	src/demo.h
	src/main.h
	src/misc.h
	src/prompts.h
	src/types.h
)

set (ZCINEMA_FORMS
	ui/findfile.ui
	ui/demoprompt.ui
	ui/unknownversion.ui
	ui/versionEditor.ui
	ui/configbox.ui
	ui/addversion.ui
)

set (ZCINEMA_RESOURCES zcinema.qrc)

if (NOT MSVC)
	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
endif()

include_directories ("${PROJECT_BINARY_DIR}")
include_directories ("${PROJECT_BINARY_DIR}/src")

if (USE_QT5)
	qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
	qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
	qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
	add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_MOC}
		${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS})
else()
	qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
	qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
	qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
	add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_RCC}
		${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC})
endif()

if (USE_QT5)
	target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
else()
	target_link_libraries (${PROJECT_NAME}
		${QT_QTCORE_LIBRARY}
		${QT_QTGUI_LIBRARY}
		${QT_QTNETWORK_LIBRARY}
		${QT_QTOPENGL_LIBRARY}
		${OPENGL_LIBRARIES}
	)
endif()

add_custom_target (make_hginfo
	COMMAND python
		"${CMAKE_SOURCE_DIR}/updaterevision.py"
		"${CMAKE_CURRENT_BINARY_DIR}/hginfo.h"
	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

add_dependencies (${PROJECT_NAME} make_hginfo)

# With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword
# which clang doesn't seem to like.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
endif()

install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial