CMakeLists.txt

Mon, 01 Jun 2015 17:06:13 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Mon, 01 Jun 2015 17:06:13 +0300
changeset 36
b8fa9171be6e
child 37
c82a86ea87be
permissions
-rw-r--r--

Converted to CMake

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 src/types.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 src/versionEditor.cpp
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 set (ZCINEMA_HEADERS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 src/cfg.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 src/config.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 src/demo.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 src/main.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 src/misc.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 src/prompts.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 src/versionEditor.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 src/types.h
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 set (ZCINEMA_FORMS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 ui/findfile.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 ui/demoprompt.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 ui/unknownversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 ui/versionEditor.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 ui/configbox.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 ui/addversion.ui
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
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 set (ZCINEMA_RESOURCES zcinema.qrc)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 if (NOT MSVC)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 endif()
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 include_directories ("${PROJECT_BINARY_DIR}")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 include_directories ("${PROJECT_BINARY_DIR}/src")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_MOC}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_RCC}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 ${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 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
72 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 target_link_libraries (${PROJECT_NAME}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 ${QT_QTCORE_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 ${QT_QTGUI_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 ${QT_QTNETWORK_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 ${QT_QTOPENGL_LIBRARY}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 ${OPENGL_LIBRARIES}
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 # 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
83 # which clang doesn't seem to like.
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial