CMakeLists.txt

changeset 44
d0bf58f3560f
parent 43
1394901b557a
child 46
07578e081ae8
equal deleted inserted replaced
43:1394901b557a 44:d0bf58f3560f
12 endif() 12 endif()
13 13
14 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) 14 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
15 15
16 set (ZCINEMA_SOURCES 16 set (ZCINEMA_SOURCES
17 src/config.cpp
18 src/configwindow.cpp
19 src/demo.cpp 17 src/demo.cpp
20 src/main.cpp 18 src/main.cpp
21 src/misc.cpp
22 src/prompts.cpp 19 src/prompts.cpp
23 ) 20 )
24 21
22 set (ZCINEMA_COMMON_SOURCES
23 src-common/config.cpp
24 src-common/misc.cpp
25 src-common/version.cpp
26 )
27
28 set (ZCINEMA_CONFIG_SOURCES
29 src-config/configwindow.cpp
30 src-config/addversionprompt.cpp
31 src-config/main.cpp
32 )
33
25 set (ZCINEMA_HEADERS 34 set (ZCINEMA_HEADERS
26 src/config.h 35 src-common/config.h
27 src/configwindow.h 36 src-common/misc.h
37 src-common/types.h
38 src-common/version.h
39 src-config/addversionprompt.h
40 src-config/configwindow.h
28 src/demo.h 41 src/demo.h
29 src/main.h
30 src/misc.h
31 src/prompts.h 42 src/prompts.h
32 src/types.h
33 ) 43 )
34 44
35 set (ZCINEMA_FORMS 45 set (ZCINEMA_FORMS
36 ui/findfile.ui 46 ui/findfile.ui
37 ui/demoprompt.ui 47 ui/demoprompt.ui
46 if (NOT MSVC) 56 if (NOT MSVC)
47 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall") 57 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
48 endif() 58 endif()
49 59
50 include_directories ("${PROJECT_BINARY_DIR}") 60 include_directories ("${PROJECT_BINARY_DIR}")
61 include_directories ("${PROJECT_SOURCE_DIR}/src")
51 include_directories ("${PROJECT_BINARY_DIR}/src") 62 include_directories ("${PROJECT_BINARY_DIR}/src")
63 include_directories ("${PROJECT_SOURCE_DIR}/src-common")
64 include_directories ("${PROJECT_BINARY_DIR}/src-common")
65 include_directories ("${PROJECT_SOURCE_DIR}/src-config")
66 include_directories ("${PROJECT_BINARY_DIR}/src-config")
52 67
53 if (USE_QT5) 68 if (USE_QT5)
54 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS}) 69 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
55 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES}) 70 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
56 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) 71 qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
57 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_MOC} 72
58 ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS}) 73 add_library (${PROJECT_NAME}-common STATIC
74 ${ZCINEMA_COMMON_SOURCES}
75 ${ZCINEMA_MOC}
76 ${ZCINEMA_QRC}
77 ${ZCINEMA_FORMS_HEADERS})
59 else() 78 else()
60 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS}) 79 qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS})
61 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) 80 qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS})
62 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES}) 81 qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES})
63 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_RCC} 82
64 ${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC}) 83 add_library (${PROJECT_NAME}-common STATIC
84 ${ZCINEMA_COMMON_SOURCES}
85 ${ZCINEMA_MOC}
86 ${ZCINEMA_RCC}
87 ${ZCINEMA_FORMS_HEADERS})
65 endif() 88 endif()
66 89
90 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES})
91 add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES})
92
67 if (USE_QT5) 93 if (USE_QT5)
68 target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) 94 target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets)
69 else() 95 else()
70 target_link_libraries (${PROJECT_NAME} 96 target_link_libraries (${PROJECT_NAME}-common ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
71 ${QT_QTCORE_LIBRARY}
72 ${QT_QTGUI_LIBRARY}
73 ${QT_QTNETWORK_LIBRARY}
74 ${QT_QTOPENGL_LIBRARY}
75 ${OPENGL_LIBRARIES}
76 )
77 endif() 97 endif()
98
99 target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common)
100 target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common)
78 101
79 add_custom_target (make_hginfo 102 add_custom_target (make_hginfo
80 COMMAND python 103 COMMAND python
81 "${CMAKE_SOURCE_DIR}/updaterevision.py" 104 "${CMAKE_SOURCE_DIR}/updaterevision.py"
82 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h" 105 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h"
83 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 106 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
84 107
85 add_dependencies (${PROJECT_NAME} make_hginfo) 108 add_dependencies (${PROJECT_NAME}-common make_hginfo)
86 109
87 # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword 110 # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword
88 # which clang doesn't seem to like. 111 # which clang doesn't seem to like.
89 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 112 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
90 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") 113 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")

mercurial