| 1 | ## |
|---|
| 2 | ## $Id$ |
|---|
| 3 | ## |
|---|
| 4 | ## This file is part of Vidalia, and is subject to the license terms in the |
|---|
| 5 | ## LICENSE file, found in the top level directory of this distribution. If |
|---|
| 6 | ## you did not receive the LICENSE file with this file, you may obtain it |
|---|
| 7 | ## from the Vidalia source package distributed by the Vidalia Project at |
|---|
| 8 | ## http://www.vidalia-project.net/. No part of Vidalia, including this file, |
|---|
| 9 | ## may be copied, modified, propagated, or distributed except according to |
|---|
| 10 | ## the terms described in the LICENSE file. |
|---|
| 11 | ## |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | set(VER_MAJOR "0") |
|---|
| 15 | set(VER_MINOR "1") |
|---|
| 16 | set(VER_PATCH "8") |
|---|
| 17 | set(VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}") |
|---|
| 18 | message(STATUS "Configuring Vidalia ${VERSION}") |
|---|
| 19 | project(Vidalia) |
|---|
| 20 | |
|---|
| 21 | ## Specify the minimim required CMake version |
|---|
| 22 | cmake_minimum_required(VERSION 2.4.0) |
|---|
| 23 | if (COMMAND cmake_policy) |
|---|
| 24 | # Force CMake 2.4 compatibility for handling linker search paths |
|---|
| 25 | cmake_policy(SET CMP0003 OLD) |
|---|
| 26 | endif(COMMAND cmake_policy) |
|---|
| 27 | |
|---|
| 28 | ## Require Qt >= 4.2.0 |
|---|
| 29 | set(QT_MIN_VERSION "4.2.0") |
|---|
| 30 | |
|---|
| 31 | ## Specify the Qt libraries used |
|---|
| 32 | include(FindQt4) |
|---|
| 33 | find_package(Qt4 REQUIRED) |
|---|
| 34 | set(QT_USE_QTNETWORK true) |
|---|
| 35 | set(QT_USE_QTXML true) |
|---|
| 36 | include(${QT_USE_FILE}) |
|---|
| 37 | include(${CMAKE_SOURCE_DIR}/cmake/VidaliaMacros.cmake) |
|---|
| 38 | include(CheckIncludeFile) |
|---|
| 39 | include(CheckIncludeFileCXX) |
|---|
| 40 | include(CheckTypeSize) |
|---|
| 41 | include(CPack) |
|---|
| 42 | |
|---|
| 43 | if(MSVC_IDE) |
|---|
| 44 | set(CMAKE_SUPPRESS_REGENERATION TRUE) |
|---|
| 45 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) |
|---|
| 46 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) |
|---|
| 47 | endif(MSVC_IDE) |
|---|
| 48 | |
|---|
| 49 | ## Define Vidalia-specific CMake options |
|---|
| 50 | if (APPLE) |
|---|
| 51 | option(OSX_FAT_BINARY "Build Vidalia as a Universal binary." OFF) |
|---|
| 52 | if (OSX_FAT_BINARY) |
|---|
| 53 | set(CMAKE_OSX_ARCHITECTURES "ppc;i386" |
|---|
| 54 | CACHE STRING "OS X build architectures" FORCE) |
|---|
| 55 | set(CMAKE_EXE_LINKER_FLAGS "-mmacosx-version-min=10.4" |
|---|
| 56 | CACHE STRING "Flags used by the linker." FORCE) |
|---|
| 57 | endif(OSX_FAT_BINARY) |
|---|
| 58 | endif(APPLE) |
|---|
| 59 | |
|---|
| 60 | ## Check for QSslSocket |
|---|
| 61 | set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${QT_INCLUDES}) |
|---|
| 62 | check_include_file_cxx("qsslsocket.h" HAVE_QSSLSOCKET_H) |
|---|
| 63 | if (HAVE_QSSLSOCKET_H) |
|---|
| 64 | check_symbol_exists(QT_NO_OPENSSL "QtGlobal" QT_NO_SSL_SUPPORT) |
|---|
| 65 | if (NOT QT_NO_SSL_SUPPORT) |
|---|
| 66 | option(USE_QSSLSOCKET "Use Qt's QSslSocket for GeoIP lookups." ON) |
|---|
| 67 | endif(NOT QT_NO_SSL_SUPPORT) |
|---|
| 68 | endif(HAVE_QSSLSOCKET_H) |
|---|
| 69 | if (USE_QSSLSOCKET) |
|---|
| 70 | if (MSVC OR UNIX) |
|---|
| 71 | include(${CMAKE_SOURCE_DIR}/cmake/FindOpenSSL.cmake) |
|---|
| 72 | endif(MSVC OR UNIX) |
|---|
| 73 | endif(USE_QSSLSOCKET) |
|---|
| 74 | |
|---|
| 75 | ## UPnP support is currently optional (enabled by default) |
|---|
| 76 | option(USE_MINIUPNPC "Enable UPnP support using the MiniUPnPc library." ON) |
|---|
| 77 | |
|---|
| 78 | ## Check for system header files |
|---|
| 79 | check_include_file("limits.h" HAVE_LIMITS_H) |
|---|
| 80 | check_include_file("sys/limits.h" HAVE_SYS_LIMITS_H) |
|---|
| 81 | |
|---|
| 82 | ## Check for the sizes of various data types |
|---|
| 83 | check_type_size(int SIZEOF_INT) |
|---|
| 84 | |
|---|
| 85 | ## Write out a configuration file |
|---|
| 86 | configure_file( |
|---|
| 87 | ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in |
|---|
| 88 | ${CMAKE_CURRENT_BINARY_DIR}/config.h |
|---|
| 89 | ) |
|---|
| 90 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
|---|
| 91 | |
|---|
| 92 | ## Add the actual source directories |
|---|
| 93 | add_subdirectory(src) |
|---|
| 94 | add_subdirectory(doc) |
|---|
| 95 | add_subdirectory(pkg) |
|---|
| 96 | |
|---|