source: pacpusframework/trunk/CMakeLists.txt@ 91

Last change on this file since 91 was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
10project(Pacpus)
11cmake_minimum_required(VERSION 2.8)
12
13# ========================================
14# Pacpus version
15# ========================================
16set(PACPUS_MAJOR_VERSION 0)
17set(PACPUS_MINOR_VERSION 0)
18set(PACPUS_PATCH_VERSION 1)
19set(PACPUS_VERSION
20 "${PACPUS_MAJOR_VERSION}.${PACPUS_MINOR_VERSION}.${PACPUS_PATCH_VERSION}")
21
22# ========================================
23# CMake variables
24# ========================================
25set(IS_BUILDING_PACPUS TRUE)
26set(PACPUS_ROOT_DIR ${CMAKE_SOURCE_DIR})
27set(PACPUS_3RD_PARTY_DIR ${PACPUS_ROOT_DIR}/3rd)
28set(PACPUS_CMAKE_DIR ${PACPUS_ROOT_DIR}/cmake)
29set(PACPUS_DOC_DIR ${PACPUS_ROOT_DIR}/doc)
30set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include/)
31set(PACPUS_SCRIPTS_DIR ${PACPUS_ROOT_DIR}/scripts)
32set(PACPUS_SOURCE_DIR ${PACPUS_ROOT_DIR}/src)
33
34
35# ========================================
36# Configure CMake
37# ========================================
38list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
39
40# ========================================
41# Import some functions
42# ========================================
43include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
44
45# ========================================
46# Configure Pacpus
47# ========================================
48include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
49
50# ========================================
51# Find dependencies
52# ========================================
53include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
54
55# ========================================
56# Handle platform specific behaviors
57# ========================================
58include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
59
60# ========================================
61# Pre-configuration of the compiler
62# ========================================
63# Includes directories
64include_directories(
65 ${PACPUS_DEPENDENCIES_INC}
66 ${PACPUS_INCLUDE_DIR}
67)
68# Compiler flags coming from PacpusDependencies and PacpusPlatforms
69add_definitions(${PACPUS_DEFINITIONS})
70
71# ========================================
72# Build the Pacpus' modules
73# ========================================
74add_subdirectory(${PACPUS_SOURCE_DIR})
75
76# ========================================
77# Build the documentation if enabled
78# ========================================
79if(PACPUS_BUILD_DOC)
80 add_subdirectory(${PACPUS_DOC_DIR})
81endif()
82
83# ========================================
84# Pacpus Installation
85# ========================================
86include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
87set( ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR} )
88
89# ========================================
90# Summary
91# ========================================
92pacpus_info("")
93pacpus_info("=====================================================================")
94pacpus_info("Configuration for Pacpus ${PACPUS_VERSION}")
95pacpus_info("=====================================================================")
96pacpus_info("")
97pacpus_info(" Platform:")
98pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
99if(CMAKE_CROSS_COMPILING)
100 pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
101endif()
102pacpus_info(" CMake:" ${CMAKE_VERSION})
103pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
104pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
105if(MSVC)
106 pacpus_info(" MSVC:" ${MSVC_VERSION})
107else()
108 pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
109endif()
110pacpus_info("")
111pacpus_info(" Compiler:")
112pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
113pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
114pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
115pacpus_info("")
116pacpus_info(" Result:")
117pacpus_info(" Install directory:" ${PACPUS_INSTALL_DIR})
118pacpus_info(" Install with version number:" ${PACPUS_INSTALL_WITH_VERSION_NUMBER})
119pacpus_info("")
120pacpus_info(" Options:")
121pacpus_info(" Logging enabled:" ${PACPUS_USE_LOG})
122pacpus_info(" Installation of 3rd party:" ${PACPUS_INSTALL_3RD})
123pacpus_info(" Documentation enabled:" ${PACPUS_BUILD_DOC})
124pacpus_info("")
125if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
126 message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
127endif()
Note: See TracBrowser for help on using the repository browser.