[47873e]: CMakeLists.txt Maximize Restore History

Download this file

CMakeLists.txt    172 lines (140 with data), 5.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright (C) 2011 David Sugar, Tycho Softworks
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
cmake_minimum_required(VERSION 2.6)
PROJECT(switchview)
set (PACKAGE switchview)
set (VERSION 0.2.1)
set(RC_VERSION ${VERSION})
STRING(REGEX REPLACE "[.]" "," RC_VERSION ${RC_VERSION})
set(RC_VERSION "${RC_VERSION},0")
INCLUDE(FindPkgConfig)
INCLUDE(CheckIncludeFiles)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
if( APPLE )
SET( MACOSX_BUNDLE_SHORT_VERSION_STRING ${VERSION} )
SET( MACOSX_BUNDLE_VERSION ${VERSION} )
SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version ${VERSION} )
if(NOT CMAKE_OSX_ARCHITECTURES)
SET( CMAKE_OSX_ARCHITECTURES ppc;i386 )
endif()
endif()
set(INSTALL_BINDIR bin)
if(WIN32 AND NOT MSYS AND NOT CYGWIN AND NOT MINGW)
set(TRANSLATIONS translations)
else()
set(INSTALL_PIXMAPS share/pixmaps)
set(INSTALL_APPLICATIONS share/applications)
set(INSTALL_MANPAGES share/man)
set(TRANSLATIONS share/switchview/translations)
set(SYSCONFDIR "/etc" CACHE PATH "config directory")
endif()
set(DEFAULT_TRANSLATIONS ${CMAKE_INSTALL_PREFIX}/${TRANSLATIONS})
MESSAGE( STATUS "Configuring ${PACKAGE} ${VERSION}...")
if (USES_COASTAL_INCLUDE_DIRS)
message(STATUS " Using local coastal dependency")
else()
pkg_check_modules(USES_COASTAL REQUIRED libcoastal>=0.6.0)
endif()
if (USES_SIPWITCH_INCLUDE_DIRS)
message(STATUS " Using local sipwitch dependency")
else()
pkg_check_modules(USES_SIPWITCH REQUIRED libsipwitch>=1.5.0)
endif()
include_directories(${USES_COASTAL_INCLUDE_DIRS} ${USES_SIPWITCH_INCLUDE_DIRS})
find_package(Qt5Core QUIET)
if(Qt5Core_FOUND)
set(QT5_FOUND true)
set(QT5_CONFIG true)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES})
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
if(Qt5_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
message(STATUS "Building with QT5 Support")
macro(qt_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
macro(qt_create_translation)
qt5_create_translation(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
macro(qt_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
else()
macro(qt_add_dbus_interface)
qt4_add_dbus_interface(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(qt_create_translation)
qt4_create_translation(${ARGN})
endmacro()
macro(qt_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
find_package(Qt4 4.8.0 REQUIRED)
if(QT4_FOUND)
include(${QT_USE_FILE})
ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_CORE_LIB ${USES_SIPWITCH_CFLAGS})
include_directories(${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR})
if(QT_IS_STATIC)
file(GLOB QT_PLUGINS ${QT_PLUGINS_DIR}/codecs/*${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
else()
message(ERROR "Building without QT")
endif()
endif()
if (USES_UCOMMON_INCLUDE_DIRS)
message(STATUS " Using local ucommon dependency")
else()
pkg_check_modules(USES_UCOMMON REQUIRED ucommon>=6.0.0)
endif()
add_definitions(${USES_UCOMMON_CFLAGS})
configure_file(${PACKAGE}-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE}.spec.cmake ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE}.spec @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(src)
add_subdirectory(system)
if(CMAKE_GENERATOR MATCHES "Unix Makefiles")
add_custom_target(cleandist
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}[-_]*.gz"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}_*.dsc"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-*.rpm"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}[-_]*.deb"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}[-_]*.deb"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-*.zip"
COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}*.changes"
)
add_custom_target(dist
DEPENDS cleandist
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND git archive --format tar --output="${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-${VERSION}.tar" --prefix="${PACKAGE}-${VERSION}/" HEAD
COMMAND gzip "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE}-${VERSION}.tar"
)
endif()