-
Notifications
You must be signed in to change notification settings - Fork 8
/
BuildConfigH.cmake
62 lines (54 loc) · 1.58 KB
/
BuildConfigH.cmake
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
# This cmake file is borrowed from libcpu, Copyright (c) 2009-2010, the libcpu developers
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckCXXSourceCompiles)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
check_library_exists(readline readline "" HAVE_LIBREADLINE)
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
CHECK_CXX_SOURCE_COMPILES("
template <bool x> struct static_assertion;
template <> struct static_assertion<true> {};
struct s { char c; int i; } __attribute__((packed));
int main() {
sizeof(static_assertion< sizeof(struct s) == sizeof(char) + sizeof(int) >);
return 0;
}
"
HAVE_ATTRIBUTE_PACKED)
CHECK_CXX_SOURCE_COMPILES("
template <bool x> struct static_assertion;
template <> struct static_assertion<true> {};
__pragma(pack(push, 1))
struct s { char c; int i; };
__pragma(pack(pop))
int main() {
sizeof(static_assertion< sizeof(struct s) == sizeof(char) + sizeof(int) >);
return 0;
}
"
HAVE_PRAGMA_PACK)
CHECK_CXX_SOURCE_COMPILES("
int main() {
struct { int i; } __attribute__((aligned(16))) x;
return 0;
}
"
HAVE_ATTRIBUTE_ALIGNED)
CHECK_CXX_SOURCE_COMPILES("
int main() {
struct { int i; } __declspec(align(16)) x;
return 0;
}
"
HAVE_DECLSPEC_ALIGN)
CHECK_CXX_SOURCE_COMPILES("
__declspec(dllexport) void foo(void);
int main() {
return 0;
}
"
HAVE_DECLSPEC_DLLEXPORT)
configure_file(include/config.h.cmake ${PROJECT_SOURCE_DIR}/include/config.h)