CMakeLists.txt

changeset 62
d4857a7aa5a1
parent 54
0b3a5bc4e8a8
child 67
c34057d3c94e
equal deleted inserted replaced
61:56c52c10e444 62:d4857a7aa5a1
1 project (zcinema) 1 project (zcinema)
2 cmake_minimum_required (VERSION 2.6) 2 cmake_minimum_required (VERSION 2.6)
3 cmake_policy (SET CMP0020 NEW) 3 cmake_policy (SET CMP0020 NEW)
4 4 find_package (Qt5Widgets REQUIRED)
5 if (USE_QT5) 5 find_package (Qt5Core REQUIRED)
6 find_package (Qt5Widgets REQUIRED)
7 find_package (Qt5Core REQUIRED)
8 else()
9 find_package (Qt4 REQUIRED)
10 endif()
11 6
12 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) 7 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
13 8
14 set (ZCINEMA_LAUNCHER_SOURCES 9 set (ZCINEMA_LAUNCHER_SOURCES
15 launcher/demo.cpp 10 launcher/demo.cpp
65 endif() 60 endif()
66 61
67 include_directories ("${PROJECT_BINARY_DIR}") 62 include_directories ("${PROJECT_BINARY_DIR}")
68 include_directories ("${PROJECT_SOURCE_DIR}") 63 include_directories ("${PROJECT_SOURCE_DIR}")
69 64
70 if (USE_QT5) 65 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
71 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS}) 66 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
72 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES}) 67 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
73 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
74 68
75 add_library (${PROJECT_NAME}-common STATIC 69 add_library (${PROJECT_NAME}-common STATIC
76 ${ZCINEMA_COMMON_SOURCES} 70 ${ZCINEMA_COMMON_SOURCES}
77 ${ZCINEMA_QRC} 71 ${ZCINEMA_QRC}
78 ${ZCINEMA_FORMS_HEADERS}) 72 ${ZCINEMA_FORMS_HEADERS})
79 else()
80 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
81 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
82 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
83
84 add_library (${PROJECT_NAME}-common STATIC
85 ${ZCINEMA_COMMON_SOURCES}
86 ${ZCINEMA_RCC}
87 ${ZCINEMA_FORMS_HEADERS})
88 endif()
89
90 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES} zcinema.rc) 73 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES} zcinema.rc)
91 add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES} zcinema.rc) 74 add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES} zcinema.rc)
92 75 target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets)
93 if (USE_QT5)
94 target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets)
95 else()
96 target_link_libraries (${PROJECT_NAME}-common ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
97 endif()
98
99 target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common) 76 target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common)
100 target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common) 77 target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common)
101 78
102 add_custom_target (make_hginfo 79 add_custom_target (make_hginfo
103 COMMAND python 80 COMMAND python

mercurial