source: pacpusframework/trunk/CMakeLists.txt@ 302

Last change on this file since 302 was 301, checked in by Marek Kurdej, 10 years ago

Some Unix fixes

  • Property svn:executable set to *
File size: 5.7 KB
RevLine 
[89]1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10project(Pacpus)
11cmake_minimum_required(VERSION 2.8)
[124]12
[128]13if(POLICY CMP0020)
[185]14 cmake_policy(SET CMP0020 NEW) # for QT5.1 on windows / not work on linux
[128]15endif()
[124]16
[185]17################################################################################
[89]18# Pacpus version
[185]19set(${PROJECT_NAME}_MAJOR_VERSION 0)
[250]20set(${PROJECT_NAME}_MINOR_VERSION 2)
[185]21set(${PROJECT_NAME}_PATCH_VERSION 0)
22set(${PROJECT_NAME}_VERSION
23 "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}")
[89]24
[185]25################################################################################
[89]26# CMake variables
27set(PACPUS_ROOT_DIR ${CMAKE_SOURCE_DIR})
28set(PACPUS_3RD_PARTY_DIR ${PACPUS_ROOT_DIR}/3rd)
29set(PACPUS_CMAKE_DIR ${PACPUS_ROOT_DIR}/cmake)
30set(PACPUS_DOC_DIR ${PACPUS_ROOT_DIR}/doc)
[185]31set(PACPUS_EXAMPLES_DIR ${PACPUS_ROOT_DIR}/examples)
[187]32set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include)
[89]33set(PACPUS_SCRIPTS_DIR ${PACPUS_ROOT_DIR}/scripts)
34set(PACPUS_SOURCE_DIR ${PACPUS_ROOT_DIR}/src)
[301]35set(PACPUS_TEST_DIR ${PACPUS_ROOT_DIR}/test)
[89]36set(IS_BUILDING_PACPUS TRUE)
37
[236]38set(PACPUS_DEFINITIONS "")
39
[185]40################################################################################
[301]41set(PACPUS_BUILD_TESTS TRUE CACHE BOOL "Whether build the tests")
42
43################################################################################
[89]44# Configure CMake
45list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
46
[185]47################################################################################
[89]48# Import some functions
49include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
50
[185]51################################################################################
[89]52# Configure Pacpus
53include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
54
[185]55################################################################################
[89]56# Find dependencies
57include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
58
[185]59################################################################################
[140]60# Handle platform-specific behaviour
[89]61include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
62
[185]63################################################################################
[140]64# Compiler flags coming from PacpusDependencies and PacpusPlatforms
[239]65message(STATUS "\${PACPUS_DEFINITIONS} = ${PACPUS_DEFINITIONS}")
66message(STATUS "\${PACPUS_DEPENDENCIES_INC} = ${PACPUS_DEPENDENCIES_INC}")
67message(STATUS "\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
[140]68add_definitions(${PACPUS_DEFINITIONS})
69
[185]70################################################################################
[89]71# Includes directories
72include_directories(
[140]73 ${PACPUS_DEPENDENCIES_INC}
74 ${PACPUS_INCLUDE_DIR}
[89]75)
76
[185]77################################################################################
[89]78# Build the Pacpus' modules
79add_subdirectory(${PACPUS_SOURCE_DIR})
80
[185]81################################################################################
82# DOCUMENTATION
[89]83if(PACPUS_BUILD_DOC)
84 add_subdirectory(${PACPUS_DOC_DIR})
85endif()
86
[185]87################################################################################
[89]88# Pacpus Installation
89include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
[175]90set(ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR})
[89]91
[185]92################################################################################
93# EXAMPLES
94if(PACPUS_BUILD_EXAMPLES)
95 add_subdirectory(${PACPUS_EXAMPLES_DIR})
96endif()
97
98################################################################################
[301]99# TESTS
100if(${PACPUS_BUILD_TESTS})
101 enable_testing()
102 #add_subdirectory(${PACPUS_TEST_DIR})
103endif()
104
105################################################################################
[185]106# SUMMARY
[89]107pacpus_info("")
108pacpus_info("=====================================================================")
[185]109pacpus_info("Configuration for Pacpus ${${PROJECT_NAME}_VERSION}")
[89]110pacpus_info("=====================================================================")
111pacpus_info("")
112pacpus_info(" Platform:")
113pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
114if(CMAKE_CROSS_COMPILING)
115 pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
116endif()
117pacpus_info(" CMake:" ${CMAKE_VERSION})
118pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
119pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
120if(MSVC)
121 pacpus_info(" MSVC:" ${MSVC_VERSION})
122else()
123 pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
124endif()
125pacpus_info("")
126pacpus_info(" Compiler:")
127pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
128pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
129pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
130pacpus_info("")
131pacpus_info(" Result:")
132pacpus_info(" Install directory:" ${PACPUS_INSTALL_DIR})
[162]133pacpus_info(" Install with version number:" ${PACPUS_INSTALL_WITH_VERSION_NUMBER})
[89]134pacpus_info("")
135pacpus_info(" Options:")
136pacpus_info(" Logging enabled:" ${PACPUS_USE_LOG})
[239]137pacpus_info(" Colored logging enabled:" ${PACPUS_LOG_COLORED_OUTPUT})
[89]138pacpus_info(" Installation of 3rd party:" ${PACPUS_INSTALL_3RD})
139pacpus_info(" Documentation enabled:" ${PACPUS_BUILD_DOC})
140pacpus_info("")
141if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
[162]142 message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
[89]143endif()
Note: See TracBrowser for help on using the repository browser.