forked from Eyescale/Lunchbox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
101 lines (83 loc) · 3.02 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright (c) 2012-2013 Stefan Eilemann <[email protected]>
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(Lunchbox)
option(LUNCHBOX_USE_OPENMP "Test for OpenMP support" ON)
option(LUNCHBOX_BUILD_V2_API
"Enable for pure 2.0 API (breaks compatibility with 1.x API)" OFF)
option(LUNCHBOX_FORCE_OPENMP "Force usage of buggy OpenMP implementation" OFF)
mark_as_advanced(LUNCHBOX_FORCE_OPENMP)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
set(RELEASE_VERSION OFF) # OFF or ABI version
set(LAST_RELEASE 1.6.0) # tarball, MacPorts, ...
set(VERSION_MAJOR "1")
set(VERSION_MINOR "7")
set(VERSION_PATCH "5")
set(LUNCHBOX_FEATURES)
if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(LUNCHBOX_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
set(LUNCHBOX_OSX_VERSION 10.6)
endif()
if(RELEASE_VERSION)
set(LUNCHBOX_DEFINITIONS -DLUNCHBOX_RELEASE)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${LUNCHBOX_OSX_VERSION}.sdk
CACHE PATH "" FORCE)
endif()
include(Common)
include(GitTargets)
include(UpdateFile)
if(LUNCHBOX_BUILD_V2_API)
set(FIND_PACKAGES_DEFINES LUNCHBOX_USE_V2_API)
set(LUNCHBOX_FEATURES "${LUNCHBOX_FEATURES} APIv2")
else()
set(FIND_PACKAGES_DEFINES LUNCHBOX_USE_V1_API)
set(LUNCHBOX_FEATURES "${LUNCHBOX_FEATURES} APIv1")
endif()
if(CMAKE_COMPILER_IS_XLCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Disable OpenMP test for xlC Debug build <http://public.kitware.com/Bug/view.php?id=13469>")
set(LUNCHBOX_USE_OPENMP OFF)
endif()
if(LUNCHBOX_USE_OPENMP)
find_package(OpenMP)
endif()
if(OPENMP_FOUND)
if(CMAKE_COMPILER_IS_GNUCXX AND GCC_COMPILER_VERSION VERSION_LESS 4.3 AND
NOT LUNCHBOX_FORCE_OPENMP)
message(STATUS "Disable OpenMP due to bug in gcc ${GCC_COMPILER_VERSION}")
else()
list(APPEND FIND_PACKAGES_DEFINES LUNCHBOX_USE_OPENMP)
set(LUNCHBOX_FEATURES "${LUNCHBOX_FEATURES} OpenMP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif(OPENMP_FOUND)
set(PROJECT_INCLUDE_NAME lunchbox)
include(FindPackages)
if(HWLOC_FOUND)
set(LUNCHBOX_FEATURES "${LUNCHBOX_FEATURES} HWLOC")
endif()
if(DNSSD_FOUND)
set(LUNCHBOX_FEATURES "${LUNCHBOX_FEATURES} zeroconf")
endif()
set(LUNCHBOX_DEFINITIONS ${LUNCHBOX_DEFINITIONS}
-DLUNCHBOX_BUILD_DIR="${CMAKE_BINARY_DIR}/")
add_definitions(${LUNCHBOX_DEFINITIONS})
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51721
# disabling the warning in the code doesn't work with Werror
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=array-bounds")
endif()
include(InstallSymlink)
include(pthreads/CMakeLists.txt)
add_subdirectory(lunchbox)
add_subdirectory(tests)
add_subdirectory(doc)
include(DoxygenRule) # must be after all targets
include(CPackConfig)
include(GNUModules)
set(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION}
# http://public.kitware.com/Bug/view.php?id=10179
"ld: warning: duplicate dylib")
include(CTest)
include(PackageConfig)
message(STATUS "Configured with ${CMAKE_BUILD_TYPE}${LUNCHBOX_FEATURES}")