source: pacpusframework/trunk/CMakeLists.txt@ 352

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

Clean finding WINSDK_LIB.

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