2 cmake_minimum_required (VERSION 2.8.0)
6 set (CMAKE_VERBOSE_MAKEFILE false)
8 add_definitions (-Wall)
9 #add_definitions (-Werror)
14 set (VERSION_LONG "${VERSION}")
17 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
18 find_program (GIT_PROG "git")
21 COMMAND ${GIT_PROG} "describe" "${BRANCH}"
23 OUTPUT_STRIP_TRAILING_WHITESPACE)
25 set (VERSION_LONG "${DESCR}")
30 find_program (DATE_PROG "date")
33 COMMAND ${DATE_PROG} "+%Y-%m-%d"
35 OUTPUT_STRIP_TRAILING_WHITESPACE)
37 set (VERSION_LONG "${VERSION_LONG} built on ${DATE}")
41 set (HOST_SETUP "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}")
42 set (VERSION_LONG "${VERSION_LONG} for ${HOST_SETUP}")
44 # Set default build type.
46 if (NOT CMAKE_BUILD_TYPE)
47 set (CMAKE_BUILD_TYPE "debug")
53 "${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in"
54 "${CMAKE_CURRENT_BINARY_DIR}/config.h"
60 "${CMAKE_CURRENT_SOURCE_DIR}/nomnom.desktop.in"
61 "${CMAKE_CURRENT_BINARY_DIR}/nomnom.desktop"
113 set (nomnom_rc rc/nomnom.qrc)
114 file (GLOB nomnom_ts tr/*.ts)
118 find_package (Qt4 4.5.0 COMPONENTS QtCore QtGui QtScript REQUIRED)
119 include (${QT_USE_FILE})
121 qt4_add_resources (nomnom_rc_src ${nomnom_rc})
122 qt4_add_translation (nomnom_qm ${nomnom_ts})
123 qt4_wrap_ui (nomnom_ui_hdr ${nomnom_ui})
124 qt4_wrap_cpp (nomnom_moc_src ${nomnom_moc_hdr})
126 # http://www.vtk.org/Wiki/CMake_2.8.0_Docs : qt4_create_translation
130 include_directories (
132 ${CMAKE_CURRENT_SOURCE_DIR}/src
133 ${CMAKE_CURRENT_SOURCE_DIR}/src/i
136 add_executable (nomnom
148 message (STATUS "nomnom version : ${VERSION}")
149 message (STATUS "host setup : ${HOST_SETUP}")
150 message (STATUS "install prefix : ${CMAKE_INSTALL_PREFIX}")
151 message (STATUS "build type : ${CMAKE_BUILD_TYPE}")
152 message (STATUS " (debug, release, relwithdebinfo, minsizerel)")
153 message (STATUS "compiler : ${CMAKE_CXX_COMPILER}")
154 message (STATUS "linker : ${CMAKE_LINKER}")
155 message (STATUS "make program : ${CMAKE_MAKE_PROGRAM}")
157 message (STATUS "date program : ${DATE_PROG}")
159 message (STATUS "date program : (not found)")
161 message (STATUS "verbose make : ${CMAKE_VERBOSE_MAKEFILE}")
164 # Force these variables to be written to cache.
166 set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH
167 "Install destination for ${PROJECT_NAME}" FORCE)
169 set (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
170 "Type of build: none, debug, release, relwithdebinfo minsizerel" FORCE)
172 set (CMAKE_VERBOSE_MAKEFILE "${CMAKE_VERBOSE_MAKEFILE}" CACHE BOOL
173 "Build with verbose makefiles: true, false" FORCE)
177 target_link_libraries (nomnom ${QT_LIBRARIES})
181 include (InstallRequiredSystemLibraries)
183 set (CPACK_SOURCE_PACKAGE_FILE_NAME
189 set (CPACK_PACKAGE_FILE_NAME ${CPACK_SOURCE_PACKAGE_FILE_NAME})
190 set (CPACK_GENERATOR "TGZ")
191 set (CPACK_SOURCE_GENERATOR "TGZ")
192 set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
193 set (CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README)
195 set (CPACK_SOURCE_IGNORE_FILES
208 # Notice the inclusion here, after setting the cpack variables.
214 "${CMAKE_CURRENT_BINARY_DIR}/nomnom" DESTINATION bin/)
216 install (FILES ${nomnom_qm} DESTINATION share/nomnom/tr/)
219 "${CMAKE_CURRENT_BINARY_DIR}/nomnom.desktop" DESTINATION share/applications/)
222 "${CMAKE_CURRENT_SOURCE_DIR}/rc/img/nomnom.png" DESTINATION share/pixmaps/)
227 "${CMAKE_CURRENT_SOURCE_DIR}/uninstall.cmake.in"
228 "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
234 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"