CMakeLists.txt

Sat, 06 Jun 2015 22:03:00 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jun 2015 22:03:00 +0300
changeset 39
2c368cf5cc19
parent 37
c82a86ea87be
child 40
809a75a7113b
permissions
-rw-r--r--

Finally done with the new Zandronum version handling

36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 project (zcinema)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 cmake_minimum_required (VERSION 2.6)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 find_package (Qt5Widgets REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 find_package (Qt5Core REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 find_package (Qt5OpenGL REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 find_package (Qt5Network REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 set (CMAKE_AUTOMOC ON)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 find_package (Qt4 REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 set (ZCINEMA_SOURCES
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 src/cfg.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18 src/config.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 src/demo.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 src/main.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 src/misc.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 src/prompts.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 set (ZCINEMA_HEADERS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 src/cfg.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 src/config.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 src/demo.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 src/main.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 src/misc.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 src/prompts.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 src/types.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 set (ZCINEMA_FORMS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 ui/findfile.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 ui/demoprompt.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 ui/unknownversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 ui/versionEditor.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 ui/configbox.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 ui/addversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 set (ZCINEMA_RESOURCES zcinema.qrc)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 if (NOT MSVC)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 include_directories ("${PROJECT_BINARY_DIR}")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 include_directories ("${PROJECT_BINARY_DIR}/src")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_MOC}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_RCC}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 ${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 target_link_libraries (${PROJECT_NAME}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 ${QT_QTCORE_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 ${QT_QTGUI_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 ${QT_QTNETWORK_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 ${QT_QTOPENGL_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 ${OPENGL_LIBRARIES}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 # which clang doesn't seem to like.
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial