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

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
43
1394901b557a Renamed cfg.cpp/h to config.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
17 src/config.cpp
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
18 src/configwindow.cpp
36
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
43
1394901b557a Renamed cfg.cpp/h to config.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 42
diff changeset
26 src/config.h
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
27 src/configwindow.h
36
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})
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
57 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_MOC}
36
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})
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 40
diff changeset
63 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_RCC}
36
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
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
79 add_custom_target (make_hginfo
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
80 COMMAND python
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
81 "${CMAKE_SOURCE_DIR}/updaterevision.py"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
82 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
83 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
84
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
85 add_dependencies (${PROJECT_NAME} make_hginfo)
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
86
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 # 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
88 # which clang doesn't seem to like.
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial