Project: Skrooge
Code Location: git://anongit.kde.org/skroogemaster
Browse
/
Download File
CMakeLists.txt
#***************************************************************************
#*   Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr  *
#*                                                                         *
#*   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 of the License, or     *
#*   (at your option) any later version.                                   *
#*                                                                         *
#*   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 <http://www.gnu.org/licenses/>  *
#***************************************************************************
MESSAGE( STATUS "..:: CMAKE ROOT ::..")

PROJECT(skrooge)

cmake_minimum_required(VERSION 2.8)
IF(POLICY CMP0017)
   CMAKE_POLICY(SET CMP0017 OLD) # or even better, NEW
ENDIF(POLICY CMP0017)
IF(POLICY CMP0002)
   CMAKE_POLICY(SET CMP0002 OLD) # to authorize the build with po files   
ENDIF(POLICY CMP0002)

FIND_PACKAGE(KDE4 4.8.0 REQUIRED)
INCLUDE(KDE4Defaults)
INCLUDE(MacroLibrary)
MESSAGE(STATUS "     KDE4 support enabled : ${KDE4_DATA_DIR}")
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})

FIND_PACKAGE(Grantlee 0.2 REQUIRED)

SET(GRANTLEE_VERSION ${Grantlee_VERSION_MAJOR}.${Grantlee_VERSION_MINOR}.${Grantlee_VERSION_PATCH})
MESSAGE( STATUS "     GRANTLEE VERSION      : " ${GRANTLEE_VERSION})

SET(SKG_VERSION "1.10.0")
SET(SKG_BETA "BETA")
SET(SOVERSION 1)
SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${skrooge_SOURCE_DIR}/cmake/modules )

IF (CMAKE_BUILD_TYPE)
ELSE (CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE profile)
#"release": optimized for speed, no debug symbols or debug messages
#"relwithdebinfo": optimized for speed, debug symbols for backtraces
#"debug": optimized, but debuggable
#"debugfull": no optimizations, full debug support
#"profile": adds coverage flags to debugfull
#"none": the build flags are manually set using the CMAKE_CXX_FLAGS option.
ENDIF (CMAKE_BUILD_TYPE)

FIND_PROGRAM(SKG_BASH bash)
MARK_AS_ADVANCED(SKG_BASH)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
OPTION(SKG_BUILD_TEST "Build the test" ON)
MESSAGE( STATUS "     PROJECT_SOURCE_DIR  : " ${PROJECT_SOURCE_DIR} )
MESSAGE( STATUS "     PROJECT_BINARY_DIR  : " ${PROJECT_BINARY_DIR} )
MESSAGE( STATUS "     BUILD_DIR           : " ${BUILD_DIR} )
MESSAGE( STATUS "     CMAKE_BUILD_TYPE    : " ${CMAKE_BUILD_TYPE} )
MESSAGE( STATUS "     CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX} )
MESSAGE( STATUS "     SKG_BUILD_TEST      : " ${SKG_BUILD_TEST} )

IF(CMAKE_BUILD_TYPE MATCHES "profile")
  MESSAGE( STATUS "     TRACES              : All traces activated")
  #add_definitions(-DSKGFULLTRACES)
ELSE(CMAKE_BUILD_TYPE MATCHES "profile")
  IF(CMAKE_BUILD_TYPE MATCHES "debug" OR SKG_BETA MATCHES "BETA")
    MESSAGE( STATUS "     TRACES              : Some traces activated")
  ELSE(CMAKE_BUILD_TYPE MATCHES "debug" OR SKG_BETA MATCHES "BETA")
    MESSAGE( STATUS "     TRACES              : All traces disabled")
    add_definitions(-DSKGNOTRACES)
  ENDIF(CMAKE_BUILD_TYPE MATCHES "debug" OR SKG_BETA MATCHES "BETA")
ENDIF(CMAKE_BUILD_TYPE MATCHES "profile")

add_definitions(-DSKGVERSION=${SKG_VERSION}${SKG_BETA})

include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}
	${CMAKE_CURRENT_SOURCE_DIR}/skgbasemodeler/
	${CMAKE_CURRENT_SOURCE_DIR}/skgbasegui/
	${CMAKE_CURRENT_BINARY_DIR}/skgbasegui/
	${CMAKE_CURRENT_SOURCE_DIR}/skgbankmodeler/
	${CMAKE_CURRENT_SOURCE_DIR}/skgbankgui
	${CMAKE_CURRENT_BINARY_DIR}/skgbankgui)

#Correction bug 207249 vvvv
#SET(CMAKE_CXX_FLAGS "-Wall" )
IF(CMAKE_COMPILER_IS_GNUCXX)
    # SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
    CHECK_CXX_COMPILER_FLAG("-Wlogical-op" WLOGICALOP)
    IF(WLOGICALOP)
        SET(CMAKE_CXX_FLAGS "-Wlogical-op ${CMAKE_CXX_FLAGS}")
    ENDIF(WLOGICALOP)
    
    CHECK_CXX_COMPILER_FLAG("-Wnoexcept" WNOEXCEPT)
    IF(WNOEXCEPT)
        SET(CMAKE_CXX_FLAGS "-Wnoexcept ${CMAKE_CXX_FLAGS}")
    ENDIF(WNOEXCEPT)    

    SET(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-variadic-macros -Wparentheses -Wmissing-braces -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Woverloaded-virtual -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused ${CMAKE_CXX_FLAGS}")
    #  SET(CMAKE_CXX_FLAGS "-std=c++0x -Wshadow  -Wctor-dtor-privacy  -Wshadow -Wold-style-cast -Wswitch-default -Wredundant-decls ${CMAKE_CXX_FLAGS}")
    MESSAGE(STATUS "     CMAKE_CXX_FLAGS : ${CMAKE_CXX_FLAGS}")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

#Correction bug 207249 ^^^^

#Default installation path
set(CMAKE_INSTALL_PREFIX ${BUILD_DIR})

# Win32 specific configuration
IF(WIN32)
    ADD_DEFINITIONS(-DSKG_PLATFORM_WIN32)
    IF(CMAKE_COMPILER_IS_GNUCXX)
	SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols" CACHE STRING "" FORCE)
    ENDIF(CMAKE_COMPILER_IS_GNUCXX)
    
    IF (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
        ADD_DEFINITIONS( -DQT_DEBUG )
    ENDIF (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)    
ELSE(WIN32)
#To solve Bug 209912:"ldd -u <library>""
#does not work on MACOS, must be done manually		SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed" CACHE STRING "" FORCE)
ENDIF(WIN32)
MESSAGE(STATUS "     CMAKE_SHARED_LINKER_FLAGS : ${CMAKE_SHARED_LINKER_FLAGS}")

#ADD_SUBDIRECTORY(skg_dataengine) #<-- Experimental

#ADD_SUBDIRECTORY
ADD_SUBDIRECTORY(skgbasemodeler)
ADD_SUBDIRECTORY(skgbankmodeler)
ADD_SUBDIRECTORY(skgbasegui)
ADD_SUBDIRECTORY(skgbankgui)

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(images)

IF(SKG_BUILD_TEST AND NOT WIN32)
	ADD_SUBDIRECTORY(tests)
ENDIF(SKG_BUILD_TEST AND NOT WIN32)

#Main application
ADD_SUBDIRECTORY(skrooge)
ADD_SUBDIRECTORY(skroogeconvert)
ADD_SUBDIRECTORY(skroogeakonadi)

CONFIGURE_FILE(scripts/addNewPlugin.sh.in scripts/addNewPlugin.sh @ONLY)
CONFIGURE_FILE(scripts/addNewImportPlugin.sh.in scripts/addNewImportPlugin.sh @ONLY)

#DOXYGEN
ADD_CUSTOM_TARGET(apidox "doxygen" "${PROJECT_SOURCE_DIR}/Doxyfile")

#ASTYLE
CONFIGURE_FILE(scripts/astyle.sh.in scripts/astyle.sh @ONLY)
ADD_CUSTOM_TARGET(astyle "scripts/astyle.sh")

#GENERATE ICONS
CONFIGURE_FILE(scripts/generateIcons.sh.in scripts/generateIcons.sh @ONLY)

#GENERATE SPLASH SCREEN
CONFIGURE_FILE(scripts/generateSplash.sh.in scripts/generateSplash.sh @ONLY)
ADD_CUSTOM_TARGET(splash "scripts/generateSplash.sh")

#STATIC CODE CHECKS
CONFIGURE_FILE(scripts/codecheck.sh.in scripts/codecheck.sh @ONLY)
ADD_CUSTOM_TARGET(codecheck "scripts/codecheck.sh")

CONFIGURE_FILE(CTestCustom.cmake CTestCustom.cmake @ONLY)

#FULL
CONFIGURE_FILE(scripts/full.sh scripts/full.sh @ONLY)
ADD_CUSTOM_TARGET(full "scripts/full.sh")