source: pacpustutorials/solutions/project_exercises/CMakeLists.txt@ 13

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

update solutions of tutorials

File size: 4.2 KB
Line 
1######################################################################################################
2#
3# created: 2015/09/18
4# filename: CMakeLists.txt
5#
6# author: Gerald Dherbomez
7# Copyright Heudiasyc (c) UMR UTC/CNRS 7253
8#
9# license: CECILL-C
10#
11# version: $Id: $
12#
13# brief: Pacpus project template
14#
15######################################################################################################
16
17project(ProjectTemplate)
18cmake_minimum_required(VERSION 2.8)
19
20# ========================================
21# ProjectTemplate version
22# ========================================
23set(ProjectTemplate_MAJOR_VERSION 0)
24set(ProjectTemplate_MINOR_VERSION 0)
25set(ProjectTemplate_PATCH_VERSION 1)
26set(ProjectTemplate_VERSION
27 "${ProjectTemplate_MAJOR_VERSION}.${ProjectTemplate_MINOR_VERSION}.${ProjectTemplate_PATCH_VERSION}")
28
29# ========================================
30# Configure CMake
31# ========================================
32if(NOT ${PACPUS_ROOT} STREQUAL "")
33 set(CMAKE_MODULE_PATH ${PACPUS_ROOT}/cmake)
34 string (REPLACE "\\" "/" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
35 message (STATUS "setting CMAKE_MODULE_PATH to: " ${CMAKE_MODULE_PATH})
36elseif( NOT $ENV{PACPUS_ROOT} STREQUAL "")
37 set(PACPUS_ROOT $ENV{PACPUS_ROOT})
38 set(CMAKE_MODULE_PATH $ENV{PACPUS_ROOT}/cmake)
39 string (REPLACE "\\" "/" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
40 message (STATUS "setting CMAKE_MODULE_PATH to: " ${CMAKE_MODULE_PATH})
41 message (STATUS "PACPUS_ROOT is: " ${PACPUS_ROOT})
42else()
43 message (FATAL_ERROR "Environment variable PACPUS_ROOT not set, please define it in your operating system or pass it as argument to the cmake command")
44endif()
45
46include(${CMAKE_MODULE_PATH}/PacpusUtilities.cmake)
47include(${CMAKE_MODULE_PATH}/PacpusConfiguration.cmake)
48include(${CMAKE_MODULE_PATH}/PacpusDependencies.cmake)
49include(${CMAKE_MODULE_PATH}/PacpusPlatforms.cmake)
50
51# ========================================
52# Pre-configuration of the compiler
53# ========================================
54find_package(Pacpus REQUIRED)
55# Includes directories
56if(PACPUS_FOUND)
57include_directories(
58 ${PACPUS_DEPENDENCIES_INC}
59 ${PACPUS_INCLUDE_DIR}
60)
61# Compiler flags coming from PacpusDependencies and PacpusPlatforms
62add_definitions(${PACPUS_DEFINITIONS})
63endif(PACPUS_FOUND)
64
65
66# ========================================
67# Build the ProjectTemplate' modules
68# ========================================
69#
70# In the following list add the plugin you want to build.
71# Paths are relative to the root of the project.
72#
73add_subdirectory(plugin_exercise_1)
74add_subdirectory(plugin_exercise_2)
75
76
77# ========================================
78# Summary
79# ========================================
80pacpus_info("")
81pacpus_info("=====================================================================")
82pacpus_info("Configuration for ProjectTemplate ${ProjectTemplate_VERSION}")
83pacpus_info("=====================================================================")
84pacpus_info("")
85pacpus_info(" Platform:")
86pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
87if(CMAKE_CROSS_COMPILING)
88 pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
89endif()
90pacpus_info(" CMake:" ${CMAKE_VERSION})
91pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
92pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
93if(MSVC)
94 pacpus_info(" MSVC:" ${MSVC_VERSION})
95else()
96 pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
97endif()
98pacpus_info("")
99pacpus_info(" Compiler:")
100pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
101pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
102pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
103pacpus_info("")
104pacpus_info(" Pacpus:")
105pacpus_info(" PacpusFramework path:" ${PACPUS_ROOT})
106pacpus_info(" Log4cxx logging enabled:" ${PACPUS_USE_LOG})
107pacpus_info("")
108if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
109 message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
110endif()
111
Note: See TracBrowser for help on using the repository browser.