source: pacpusframework/trunk/CMakeLists.txt@ 311

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

Some Unix fixes

  • Property svn:executable set to *
File size: 5.7 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10project(Pacpus)
11cmake_minimum_required(VERSION 2.8)
12
13if(POLICY CMP0020)
14 cmake_policy(SET CMP0020 NEW) # for QT5.1 on windows / not work on linux
15endif()
16
17################################################################################
18# Pacpus version
19set(${PROJECT_NAME}_MAJOR_VERSION 0)
20set(${PROJECT_NAME}_MINOR_VERSION 2)
21set(${PROJECT_NAME}_PATCH_VERSION 0)
22set(${PROJECT_NAME}_VERSION
23 "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}")
24
25################################################################################
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)
31set(PACPUS_EXAMPLES_DIR ${PACPUS_ROOT_DIR}/examples)
32set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include)
33set(PACPUS_SCRIPTS_DIR ${PACPUS_ROOT_DIR}/scripts)
34set(PACPUS_SOURCE_DIR ${PACPUS_ROOT_DIR}/src)
35set(PACPUS_TEST_DIR ${PACPUS_ROOT_DIR}/test)
36set(IS_BUILDING_PACPUS TRUE)
37
38set(PACPUS_DEFINITIONS "")
39
40################################################################################
41set(PACPUS_BUILD_TESTS TRUE CACHE BOOL "Whether build the tests")
42
43################################################################################
44# Configure CMake
45list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
46
47################################################################################
48# Import some functions
49include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
50
51################################################################################
52# Configure Pacpus
53include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
54
55################################################################################
56# Find dependencies
57include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
58
59################################################################################
60# Handle platform-specific behaviour
61include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
62
63################################################################################
64# Compiler flags coming from PacpusDependencies and PacpusPlatforms
65message(STATUS "\${PACPUS_DEFINITIONS} = ${PACPUS_DEFINITIONS}")
66message(STATUS "\${PACPUS_DEPENDENCIES_INC} = ${PACPUS_DEPENDENCIES_INC}")
67message(STATUS "\${PACPUS_DEPENDENCIES_LIB} = ${PACPUS_DEPENDENCIES_LIB}")
68add_definitions(${PACPUS_DEFINITIONS})
69
70################################################################################
71# Includes directories
72include_directories(
73 ${PACPUS_DEPENDENCIES_INC}
74 ${PACPUS_INCLUDE_DIR}
75)
76
77################################################################################
78# Build the Pacpus' modules
79add_subdirectory(${PACPUS_SOURCE_DIR})
80
81################################################################################
82# DOCUMENTATION
83if(PACPUS_BUILD_DOC)
84 add_subdirectory(${PACPUS_DOC_DIR})
85endif()
86
87################################################################################
88# Pacpus Installation
89include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
90set(ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR})
91
92################################################################################
93# EXAMPLES
94if(PACPUS_BUILD_EXAMPLES)
95 add_subdirectory(${PACPUS_EXAMPLES_DIR})
96endif()
97
98################################################################################
99# TESTS
100if(${PACPUS_BUILD_TESTS})
101 enable_testing()
102 #add_subdirectory(${PACPUS_TEST_DIR})
103endif()
104
105################################################################################
106# SUMMARY
107pacpus_info("")
108pacpus_info("=====================================================================")
109pacpus_info("Configuration for Pacpus ${${PROJECT_NAME}_VERSION}")
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})
133pacpus_info(" Install with version number:" ${PACPUS_INSTALL_WITH_VERSION_NUMBER})
134pacpus_info("")
135pacpus_info(" Options:")
136pacpus_info(" Logging enabled:" ${PACPUS_USE_LOG})
137pacpus_info(" Colored logging enabled:" ${PACPUS_LOG_COLORED_OUTPUT})
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}")
142 message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
143endif()
Note: See TracBrowser for help on using the repository browser.