# Copyright (C) 2010 Felix Geyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 or (at your option) # version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . project(KeePassX) cmake_minimum_required(VERSION 2.6.0) set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) option(WITH_TESTS "Enable building of unit tests" ON) set( KEEPASSX_VERSION "0.9.0" ) if ( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) set (SOLARIS true) endif( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -fno-common -fno-exceptions -fno-rtti") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_KEYWORDS -DQT_NO_EXCEPTIONS -DQT_NO_STL") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wold-style-cast -Wnon-virtual-dtor -Wcast-align") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wformat-security -Woverloaded-virtual -Wno-long-long") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi -fno-common") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wundef -Wcast-align -Wchar-subscripts -Wpointer-arith") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings -Wformat-security -Werror-implicit-function-declaration") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute -Wno-long-long") if( UNIX AND NOT APPLE AND NOT SOLARIS ) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined" ) endif( UNIX AND NOT APPLE AND NOT SOLARIS) endif(CMAKE_COMPILER_IS_GNUCXX) if( APPLE OR MINGW ) set( PROGNAME KeePassX ) else( APPLE OR MINGW ) set( PROGNAME keepassx ) endif( APPLE OR MINGW ) if( WITH_TESTS ) enable_testing() set(QT_USE_QTTEST TRUE) endif( WITH_TESTS ) set(QT_MIN_VERSION "4.6.0") set(QT_USE_QTMAIN TRUE) find_package(Qt4 REQUIRED) include(${QT_USE_FILE}) find_package(Libgcrypt REQUIRED) find_package(ZLIB REQUIRED) include(CheckCXXSourceCompiles) check_cxx_source_compiles(" #include #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1200) #error zlib 1.2.x or higher is required to use the gzip format #endif int main() { return 0; }" ZLIB_SUPPORTS_GZIP) if(NOT ZLIB_SUPPORTS_GZIP) message(FATAL_ERROR "zlib 1.2.x or higher is required to use the gzip format") endif(NOT ZLIB_SUPPORTS_GZIP) add_subdirectory(src) add_subdirectory(utils) if( WITH_TESTS ) add_subdirectory(tests) endif( WITH_TESTS )