source: pacpussensors/trunk/CMakeLists.txt@ 28

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

Minor: CMakeLists fixes (Qt4/Qt5 compatibility).

File size: 5.7 KB
RevLine 
[1]1######################################################################################################
2# #
3# __________ _________ #
4# \______ \_____ ____ ______ __ __ ______/ _____/ ____ ____ _________________ ______ #
5# | ___/\__ \ _/ ___\\____ \| | \/ ___/\_____ \_/ __ \ / \ / ___/ _ \_ __ \/ ___/ #
6# | | / __ \\ \___| |_> > | /\___ \ / \ ___/| | \\___ ( <_> ) | \/\___ \ #
7# |____| (____ /\___ > __/|____//____ >_______ /\___ >___| /____ >____/|__| /____ > #
8# \/ \/|__| \/ \/ \/ \/ \/ \/ #
9# #
10######################################################################################################
11
12project(PacpusSensors)
13cmake_minimum_required(VERSION 2.8)
14
15# ========================================
16# PacpusSensors version
17# ========================================
18set(PacpusSensors_MAJOR_VERSION 0)
19set(PacpusSensors_MINOR_VERSION 1)
20set(PacpusSensors_PATCH_VERSION 0)
21set(PacpusSensors_VERSION
22 "${PacpusSensors_MAJOR_VERSION}.${PacpusSensors_MINOR_VERSION}.${PacpusSensors_PATCH_VERSION}")
23
24# ========================================
25# CMake variables
26# ========================================
27#set(PacpusSensors_ROOT_DIR ${CMAKE_SOURCE_DIR})
28#set(PacpusSensors_CMAKE_DIR ${PacpusSensors_ROOT_DIR}/cmake)
29#set(PacpusSensors_DOC_DIR ${PacpusSensors_ROOT_DIR}/doc)
30#set(PacpusSensors_INCLUDE_DIR ${PacpusSensors_ROOT_DIR}/include)
[5]31set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include)
[1]32
33# ========================================
34# Configure CMake
35# ========================================
[9]36if(NOT ${PACPUS_ROOT} STREQUAL "")
[1]37 set(CMAKE_MODULE_PATH ${PACPUS_ROOT}/cmake)
38 string (REPLACE "\\" "/" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
39 message (STATUS "setting CMAKE_MODULE_PATH to: " ${CMAKE_MODULE_PATH})
40elseif( NOT $ENV{PACPUS_ROOT} STREQUAL "")
[5]41 set(PACPUS_ROOT $ENV{PACPUS_ROOT})
[1]42 set(CMAKE_MODULE_PATH $ENV{PACPUS_ROOT}/cmake)
43 string (REPLACE "\\" "/" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
44 message (STATUS "setting CMAKE_MODULE_PATH to: " ${CMAKE_MODULE_PATH})
[5]45 message (STATUS "PACPUS_ROOT is: " ${PACPUS_ROOT})
[1]46else()
47 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")
48endif()
49
[27]50include(${CMAKE_MODULE_PATH}/PacpusUtilities.cmake)
51include(${CMAKE_MODULE_PATH}/PacpusConfiguration.cmake)
52include(${CMAKE_MODULE_PATH}/PacpusDependencies.cmake)
53include(${CMAKE_MODULE_PATH}/PacpusPlatforms.cmake)
[1]54
55# ========================================
56# Pre-configuration of the compiler
57# ========================================
58find_package(Pacpus REQUIRED)
59# Includes directories
60if(PACPUS_FOUND)
61include_directories(
62 ${PACPUS_DEPENDENCIES_INC}
63 ${PACPUS_INCLUDE_DIR}
64)
65# Compiler flags coming from PacpusDependencies and PacpusPlatforms
66add_definitions(${PACPUS_DEFINITIONS})
67endif(PACPUS_FOUND)
68
69
70# ========================================
71# Find dependencies
72# ========================================
73find_package(Qt4 REQUIRED)
74if(QT4_FOUND)
75 set(QT_USE_QTNETWORK TRUE)
76 set(QT_USE_QTOPENGL TRUE)
77 set(QT_USE_QTXML TRUE)
78 include(${QT_USE_FILE})
79 add_definitions( ${QT_DEFINITIONS} )
80 add_definitions( -DQT_PLUGIN )
81endif(QT4_FOUND)
82
[4]83include_directories(
84 ${PACPUS_DEPENDENCIES_INC}
85 ${PACPUS_INCLUDE_DIR}
86 ${PACPUS_INCLUDE_HINT}
87 ${PACPUS_INCLUDE_HINT}/Pacpus
88 ./PACPUS/include
89)
[1]90
91# ========================================
92# Build the PacpusSensors' modules
93# ========================================
[21]94#add_subdirectory(Alasca)
95#add_subdirectory(CanGateway)
96#add_subdirectory(LMOComponent)
97#add_subdirectory(StdDbtPlayerComponents)
98add_subdirectory(Dualshock)
99add_subdirectory(Wifibot)
100add_subdirectory(PacpusSocket)
[1]101
102# ========================================
103# Summary
104# ========================================
105pacpus_info("")
106pacpus_info("=====================================================================")
107pacpus_info("Configuration for PacpusSensors ${PacpusSensors_VERSION}")
108pacpus_info("=====================================================================")
109pacpus_info("")
110pacpus_info(" Platform:")
111pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
112if(CMAKE_CROSS_COMPILING)
113 pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
114endif()
115pacpus_info(" CMake:" ${CMAKE_VERSION})
116pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
117pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
118if(MSVC)
119 pacpus_info(" MSVC:" ${MSVC_VERSION})
120else()
121 pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
122endif()
123pacpus_info("")
124pacpus_info(" Compiler:")
125pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
126pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
127pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
128pacpus_info("")
129pacpus_info(" Pacpus:")
130pacpus_info(" PacpusFramework path:" ${PACPUS_ROOT})
131pacpus_info(" Log4cxx logging enabled:" ${PACPUS_USE_LOG})
132pacpus_info("")
133if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
134 message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
135endif()
Note: See TracBrowser for help on using the repository browser.