CMakeLists.txt

Sat, 06 Jun 2015 23:17:33 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jun 2015 23:17:33 +0300
changeset 48
e121ea9dba93
parent 47
4a0ad0a08ea1
child 49
7a27d14a4df1
permissions
-rw-r--r--

Now C++03 compatible

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 set (CMAKE_AUTOMOC ON)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 find_package (Qt4 REQUIRED)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
14 set (ZCINEMA_LAUNCHER_SOURCES
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
15 launcher/demo.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
16 launcher/main.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
17 launcher/prompts.cpp
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
20 set (ZCINEMA_COMMON_SOURCES
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
21 commonlib/config.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
22 commonlib/misc.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
23 commonlib/version.cpp
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
24 )
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
25
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
26 set (ZCINEMA_CONFIG_SOURCES
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
27 config/configwindow.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
28 config/addversionprompt.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
29 config/main.cpp
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
30 )
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
31
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 set (ZCINEMA_HEADERS
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
33 commonlib/config.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
34 commonlib/misc.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
35 commonlib/types.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
36 commonlib/version.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
37 config/addversionprompt.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
38 config/configwindow.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
39 launcher/demo.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
40 launcher/prompts.h
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 )
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 set (ZCINEMA_FORMS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 ui/findfile.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 ui/demoprompt.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 ui/unknownversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 ui/configbox.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 ui/addversion.ui
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
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 set (ZCINEMA_RESOURCES zcinema.qrc)
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 (NOT MSVC)
48
e121ea9dba93 Now C++03 compatible
Teemu Piippo <crimsondusk64@gmail.com>
parents: 47
diff changeset
54 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall")
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 include_directories ("${PROJECT_BINARY_DIR}")
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
58 include_directories ("${PROJECT_SOURCE_DIR}")
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 if (USE_QT5)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
64
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
65 add_library (${PROJECT_NAME}-common STATIC
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
66 ${ZCINEMA_COMMON_SOURCES}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
67 ${ZCINEMA_MOC}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
68 ${ZCINEMA_QRC}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
69 ${ZCINEMA_FORMS_HEADERS})
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 else()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
74
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
75 add_library (${PROJECT_NAME}-common STATIC
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
76 ${ZCINEMA_COMMON_SOURCES}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
77 ${ZCINEMA_MOC}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
78 ${ZCINEMA_RCC}
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
79 ${ZCINEMA_FORMS_HEADERS})
36
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
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
82 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES})
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
83 add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES})
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
84
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 if (USE_QT5)
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
86 target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets)
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 else()
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
88 target_link_libraries (${PROJECT_NAME}-common ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
91 target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common)
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
92 target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common)
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
93
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
94 add_custom_target (make_hginfo
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
95 COMMAND python
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
96 "${CMAKE_SOURCE_DIR}/updaterevision.py"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
97 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
98 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
99
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
100 add_dependencies (${PROJECT_NAME}-common make_hginfo)
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
101
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 # 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
103 # which clang doesn't seem to like.
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial