CMakeLists.txt

changeset 926
e1ae2dbcae8e
parent 884
d820588bf4f1
child 930
ab77deb851fa
child 931
85080f7a1c20
equal deleted inserted replaced
920:147497785496 926:e1ae2dbcae8e
4 # The original QMake file was created on Sat Sep 22 17:29:49 2012 4 # The original QMake file was created on Sat Sep 22 17:29:49 2012
5 # 5 #
6 ###################################################################### 6 ######################################################################
7 7
8 project (ldforge) 8 project (ldforge)
9 add_subdirectory (updaterevision)
10 add_subdirectory (codegen) 9 add_subdirectory (codegen)
11 cmake_minimum_required (VERSION 2.6) 10 cmake_minimum_required (VERSION 2.6)
12 11
13 option (TRANSPARENT_DIRECT_COLORS "Enables non-standard transparent direct colors" OFF) 12 option (TRANSPARENT_DIRECT_COLORS "Enables non-standard transparent direct colors" OFF)
14 option (USE_QT5 "Use Qt5 instead of Qt4" OFF) 13 option (USE_QT5 "Use Qt5 instead of Qt4" OFF)
23 find_package (Qt4 REQUIRED) 22 find_package (Qt4 REQUIRED)
24 endif() 23 endif()
25 24
26 find_package (OpenGL REQUIRED) 25 find_package (OpenGL REQUIRED)
27 26
28 get_target_property (UPDATEREVISION_EXE updaterevision LOCATION)
29 get_target_property (CODEGEN_EXE codegen LOCATION) 27 get_target_property (CODEGEN_EXE codegen LOCATION)
30
31 add_custom_target (revision_check ALL
32 COMMAND ${UPDATEREVISION_EXE} ${CMAKE_SOURCE_DIR} hginfo.h
33 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
34 DEPENDS updaterevision)
35
36 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) 28 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
37 29
38 set (LDFORGE_SOURCES 30 set (LDFORGE_SOURCES
39 src/actions.cc 31 src/actions.cc
40 src/actionsEdit.cc 32 src/actionsEdit.cc
171 163
172 if (USE_QT5) 164 if (USE_QT5)
173 qt5_generate_moc (LDFORGE_MOC ${LDFORGE_HEADERS}) 165 qt5_generate_moc (LDFORGE_MOC ${LDFORGE_HEADERS})
174 qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES}) 166 qt5_add_resources (LDFORGE_QRC ${LDFORGE_RESOURCES})
175 qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS}) 167 qt5_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
176 add_executable (ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_MOC} 168 add_executable (${PROJECT_NAME} WIN32 ${LDFORGE_SOURCES} ${LDFORGE_MOC}
177 ${LDFORGE_QRC} ${LDFORGE_FORMS_HEADERS}) 169 ${LDFORGE_QRC} ${LDFORGE_FORMS_HEADERS})
178 else() 170 else()
179 qt4_wrap_cpp (LDFORGE_MOC ${LDFORGE_HEADERS}) 171 qt4_wrap_cpp (LDFORGE_MOC ${LDFORGE_HEADERS})
180 qt4_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS}) 172 qt4_wrap_ui (LDFORGE_FORMS_HEADERS ${LDFORGE_FORMS})
181 qt4_add_resources (LDFORGE_RCC ${LDFORGE_RESOURCES}) 173 qt4_add_resources (LDFORGE_RCC ${LDFORGE_RESOURCES})
182 add_executable (ldforge WIN32 ${LDFORGE_SOURCES} ${LDFORGE_RCC} 174 add_executable (${PROJECT_NAME} WIN32 ${LDFORGE_SOURCES} ${LDFORGE_RCC}
183 ${LDFORGE_FORMS_HEADERS} ${LDFORGE_MOC}) 175 ${LDFORGE_FORMS_HEADERS} ${LDFORGE_MOC})
184 endif() 176 endif()
185 177
186 if (USE_QT5) 178 if (USE_QT5)
187 target_link_libraries (ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) 179 target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
188 else() 180 else()
189 target_link_libraries (ldforge 181 target_link_libraries (${PROJECT_NAME}
190 ${QT_QTCORE_LIBRARY} 182 ${QT_QTCORE_LIBRARY}
191 ${QT_QTGUI_LIBRARY} 183 ${QT_QTGUI_LIBRARY}
192 ${QT_QTNETWORK_LIBRARY} 184 ${QT_QTNETWORK_LIBRARY}
193 ${QT_QTOPENGL_LIBRARY} 185 ${QT_QTOPENGL_LIBRARY}
194 ${OPENGL_LIBRARIES} 186 ${OPENGL_LIBRARIES}
195 ) 187 )
196 endif() 188 endif()
197 189
198 add_dependencies (ldforge revision_check codegeneration) 190 add_dependencies (${PROJECT_NAME} revision_check codegeneration)
199 install (TARGETS ldforge RUNTIME DESTINATION bin) 191 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
192
193 add_custom_target (make_hginfo_h
194 COMMAND python
195 "${CMAKE_SOURCE_DIR}/updaterevision.py"
196 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h")
197 add_dependencies (${PROJECT_NAME} make_hginfo_h)

mercurial