Repository navigation
Expand file tree
/
Copy pathCMakeSettings.txt
More file actions
132 lines (125 loc) · 7.8 KB
/
Copy pathCMakeSettings.txt
File metadata and controls
132 lines (125 loc) · 7.8 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# --------------------------------------------------------------------------- #
# Custom CMake settings for SMS++ projects #
# #
# Uncomment the lines you need. #
# You can also specify single variables with the -D option, e.g.: #
# #
# cmake -DCMAKE_BUILD_TYPE=Debug .. #
# #
# Donato Meoli #
# Dipartimento di Informatica #
# Universita' di Pisa #
# --------------------------------------------------------------------------- #
# ----- Build settings ------------------------------------------------------ #
# CMake already adds the following flags for each build type: #
# #
# - Debug: -g #
# - MinSizeRel: -Os -DNDEBUG #
# - Release: -O3 -DNDEBUG #
# - RelWithDebInfo: -O2 -g -DNDEBUG #
# --------------------------------------------------------------------------- #
# Build type: Release unless one is given, e.g., with -DCMAKE_BUILD_TYPE=Debug;
# a build with no type has no optimization at all. Multi-config generators
# (Visual Studio, Xcode) choose it at build time and are left alone
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif ()
# Shared or static libraries
set(BUILD_SHARED_LIBS ON)
# Export packages from build tree (so they are found without installing them)
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
# Enable verbose makefiles
#set(CMAKE_VERBOSE_MAKEFILE ON)
# FindBoost.cmake contains:
#if (Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.79.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
# message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
#endif ()
set(Boost_NO_WARN_NEW_VERSIONS 1)
# Add compilation and linking flags
# Note: add_compile_options() is recommended over CMAKE_<LANG>_FLAGS_<CONFIG>
if (MSVC)
set(MSVC_DISABLED_WARNINGS_LIST
"C4005" # 'identifier' : macro redefinition
"C4018" # 'expression' : signed/unsigned mismatch
"C4057" # 'operator' : 'identifier1' indirection to
# slightly different base types from 'identifier2'
"C4060" # switch statement contains no 'case' or 'default' labels
"C4065" # switch statement contains 'default' but no 'case' labels
"C4068" # unknown pragma 'identifier'
"C4100" # 'identifier' : unreferenced formal parameter
"C4101" # 'identifier' : unreferenced local variable
"C4102" # 'label' : unreferenced label
"C4127" # conditional expression is constant
"C4146" # unary minus operator applied to unsigned type,
# result still unsigned
"C4189" # 'identifier' : local variable is initialized but not referenced
"C4244" # 'argument' : conversion from 'type1' to 'type2',
# possible loss of data
"C4245" # 'conversion' : conversion from 'type1' to 'type2',
# signed/unsigned mismatch
"C4267" # 'var' : conversion from 'size_t' to 'type',
# possible loss of data
"C4324" # 'structure' : structure was padded due to alignment specifier
"C4373" # 'function' : virtual function overrides 'base_function',
# previous versions of the compiler did not override when
# parameters only differed by const/volatile qualifiers
"C4389" # 'operator' : signed/unsigned mismatch
"C4390" # ';' : empty controlled statement found; is this the intent?
"C4456" # declaration of 'identifier' hides previous local declaration
"C4457" # declaration of 'identifier' hides function parameter
"C4458" # declaration of 'identifier' hides class member
"C4459" # declaration of 'identifier' hides global declaration
"C4505" # 'function' : unreferenced function with internal linkage
# has been removed
"C4701" # potentially uninitialized local variable 'name' used
"C4702" # unreachable code
"C4703" # potentially uninitialized local pointer variable 'name' used
"C4706" # assignment within conditional expression
"C4717" # 'function' : recursive on all control paths, function will
# cause runtime stack overflow
"C4804" # 'operation' : unsafe use of type 'bool' in operation
"C4834" # discarding return value of function with 'nodiscard' attribute
"C4858" # discarding return value: this call discards the return value
# of a function whose return type is marked [[nodiscard]]
"C4949" # pragma 'pragma' is meaningful only when compiled with
# '/clr[:option]'
"C4996" # The POSIX name for this item is deprecated.
# Instead, use the ISO C and C++ conformant name
"C5054" # operator 'operator' : deprecated between enumerations of
# different types (C++20)
)
string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR ${MSVC_DISABLED_WARNINGS_LIST})
string(REGEX REPLACE "[/-]W[1234][ ]?" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# /Zc:__cplusplus forces MSVC to report the real value of the __cplusplus
# macro (by default it is stuck at 199711L even in /std:c++17 or /std:c++20
# mode). FastFlow guards all its C++11 code paths with `#if __cplusplus >=
# 201103L`, so without this flag those paths are skipped and the build fails
# in ff/spin-lock.hpp, ff/utils.hpp, ff/dynqueue.hpp, ... (works on Linux
# because GCC/Clang already report __cplusplus correctly).
# NOMINMAX prevents <windows.h> from defining the min()/max() function-like
# macros, which otherwise break every `std::min`/`std::max` call (FastFlow
# uses them in ff/parallel_for_internals.hpp). FastFlow does define NOMINMAX
# itself, but only inside ff/platforms/platform.h, i.e. too late if any other
# header pulled in <windows.h> first, so we define it globally and up front.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP -W4 /Zc:__cplusplus /DNOMINMAX ${MSVC_DISABLED_WARNINGS_STR}")
add_link_options("/IGNORE:4006,4075,4088,4255")
else () # Unix
add_compile_options(
"-Wno-enum-compare" "-Wno-enum-conversion" "-Wno-deprecated-declarations"
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-undefined-internal>"
"-Wno-deprecated-enum-enum-conversion" "-Wno-deprecated-enum-float-conversion" "-Wno-free-nonheap-object" # C++20
"-DBUILD_CPXSTATIC" "-DCPXSIZE_BITS_TEST_DISABLE"
#"-ferror-limit=1" "-fexceptions"
#"-Wall" "-Wpedantic" "-Wextra"
#"-fsanitize=undefined" "-fsanitize=address" "-fno-omit-frame-pointer"
"$<$<CONFIG:DEBUG>:-fno-inline>"
#"$<$<CONFIG:MINSIZEREL>:>"
#"$<$<CONFIG:RELEASE>:>"
#"$<$<CONFIG:RELWITHDEBINFO>:>"
)
#add_link_options("-fsanitize=address")
endif ()
# Custom output directories
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)