[11] | 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 |
|
---|
| 17 | project(ProjectTemplate)
|
---|
| 18 | cmake_minimum_required(VERSION 2.8)
|
---|
| 19 |
|
---|
| 20 | # ========================================
|
---|
| 21 | # ProjectTemplate version
|
---|
| 22 | # ========================================
|
---|
| 23 | set(ProjectTemplate_MAJOR_VERSION 0)
|
---|
| 24 | set(ProjectTemplate_MINOR_VERSION 0)
|
---|
| 25 | set(ProjectTemplate_PATCH_VERSION 1)
|
---|
| 26 | set(ProjectTemplate_VERSION
|
---|
| 27 | "${ProjectTemplate_MAJOR_VERSION}.${ProjectTemplate_MINOR_VERSION}.${ProjectTemplate_PATCH_VERSION}")
|
---|
| 28 |
|
---|
| 29 | # ========================================
|
---|
| 30 | # Configure CMake
|
---|
| 31 | # ========================================
|
---|
| 32 | if(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})
|
---|
| 36 | elseif( 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})
|
---|
| 42 | else()
|
---|
| 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")
|
---|
| 44 | endif()
|
---|
| 45 |
|
---|
| 46 | include(${CMAKE_MODULE_PATH}/PacpusUtilities.cmake)
|
---|
| 47 | include(${CMAKE_MODULE_PATH}/PacpusConfiguration.cmake)
|
---|
| 48 | include(${CMAKE_MODULE_PATH}/PacpusDependencies.cmake)
|
---|
| 49 | include(${CMAKE_MODULE_PATH}/PacpusPlatforms.cmake)
|
---|
| 50 |
|
---|
| 51 | # ========================================
|
---|
| 52 | # Pre-configuration of the compiler
|
---|
| 53 | # ========================================
|
---|
| 54 | find_package(Pacpus REQUIRED)
|
---|
| 55 | # Includes directories
|
---|
| 56 | if(PACPUS_FOUND)
|
---|
| 57 | include_directories(
|
---|
| 58 | ${PACPUS_DEPENDENCIES_INC}
|
---|
| 59 | ${PACPUS_INCLUDE_DIR}
|
---|
| 60 | )
|
---|
| 61 | # Compiler flags coming from PacpusDependencies and PacpusPlatforms
|
---|
| 62 | add_definitions(${PACPUS_DEFINITIONS})
|
---|
| 63 | endif(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 | #
|
---|
| 73 | add_subdirectory(plugin_exercise_1)
|
---|
| 74 | add_subdirectory(plugin_exercise_2)
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | # ========================================
|
---|
| 78 | # Summary
|
---|
| 79 | # ========================================
|
---|
| 80 | pacpus_info("")
|
---|
| 81 | pacpus_info("=====================================================================")
|
---|
| 82 | pacpus_info("Configuration for ProjectTemplate ${ProjectTemplate_VERSION}")
|
---|
| 83 | pacpus_info("=====================================================================")
|
---|
| 84 | pacpus_info("")
|
---|
| 85 | pacpus_info(" Platform:")
|
---|
| 86 | pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
---|
| 87 | if(CMAKE_CROSS_COMPILING)
|
---|
| 88 | pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
|
---|
| 89 | endif()
|
---|
| 90 | pacpus_info(" CMake:" ${CMAKE_VERSION})
|
---|
| 91 | pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
|
---|
| 92 | pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
|
---|
| 93 | if(MSVC)
|
---|
| 94 | pacpus_info(" MSVC:" ${MSVC_VERSION})
|
---|
| 95 | else()
|
---|
| 96 | pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
|
---|
| 97 | endif()
|
---|
| 98 | pacpus_info("")
|
---|
| 99 | pacpus_info(" Compiler:")
|
---|
| 100 | pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
|
---|
| 101 | pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
|
---|
| 102 | pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
|
---|
| 103 | pacpus_info("")
|
---|
| 104 | pacpus_info(" Pacpus:")
|
---|
| 105 | pacpus_info(" PacpusFramework path:" ${PACPUS_ROOT})
|
---|
| 106 | pacpus_info(" Log4cxx logging enabled:" ${PACPUS_USE_LOG})
|
---|
| 107 | pacpus_info("")
|
---|
| 108 | if("${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")
|
---|
| 110 | endif()
|
---|
| 111 |
|
---|