1 | include(CheckTypeSize)
|
---|
2 |
|
---|
3 | check_type_size("int16_t" INT16_SIZE LANGUAGE C)
|
---|
4 | check_type_size("uint16_t" UINT16_SIZE LANGUAGE C)
|
---|
5 | check_type_size("u_int16_t" U_INT16_SIZE LANGUAGE C)
|
---|
6 | check_type_size("int32_t" INT32_SIZE LANGUAGE C)
|
---|
7 | check_type_size("uint32_t" UINT32_SIZE LANGUAGE C)
|
---|
8 | check_type_size("u_int32_t" U_INT32_SIZE LANGUAGE C)
|
---|
9 | check_type_size("int64_t" INT64_SIZE LANGUAGE C)
|
---|
10 | check_type_size("short" SHORT_SIZE LANGUAGE C)
|
---|
11 | check_type_size("int" INT_SIZE LANGUAGE C)
|
---|
12 | check_type_size("long" LONG_SIZE LANGUAGE C)
|
---|
13 | check_type_size("long long" LONG_LONG_SIZE LANGUAGE C)
|
---|
14 |
|
---|
15 | if(INT16_SIZE EQUAL 2)
|
---|
16 | set(SIZE16 "int16_t")
|
---|
17 | elseif(SHORT_SIZE EQUAL 2)
|
---|
18 | set(SIZE16 "short")
|
---|
19 | elseif(INT_SIZE EQUAL 2)
|
---|
20 | set(SIZE16 "int")
|
---|
21 | else()
|
---|
22 | message(FATAL_ERROR "No 16 bit type found on this platform!")
|
---|
23 | endif()
|
---|
24 |
|
---|
25 | if(UINT16_SIZE EQUAL 2)
|
---|
26 | set(USIZE16 "uint16_t")
|
---|
27 | elseif(SHORT_SIZE EQUAL 2)
|
---|
28 | set(USIZE16 "unsigned short")
|
---|
29 | elseif(INT_SIZE EQUAL 2)
|
---|
30 | set(USIZE16 "unsigned int")
|
---|
31 | elseif(U_INT_SIZE EQUAL 2)
|
---|
32 | set(USIZE16 "u_int16_t")
|
---|
33 | else()
|
---|
34 | message(FATAL_ERROR "No unsigned 16 bit type found on this platform!")
|
---|
35 | endif()
|
---|
36 |
|
---|
37 | if(INT32_SIZE EQUAL 4)
|
---|
38 | set(SIZE32 "int32_t")
|
---|
39 | elseif(SHORT_SIZE EQUAL 4)
|
---|
40 | set(SIZE32 "short")
|
---|
41 | elseif(INT_SIZE EQUAL 4)
|
---|
42 | set(SIZE32 "int")
|
---|
43 | elseif(LONG_SIZE EQUAL 4)
|
---|
44 | set(SIZE16 "long")
|
---|
45 | else()
|
---|
46 | message(FATAL_ERROR "No 32 bit type found on this platform!")
|
---|
47 | endif()
|
---|
48 |
|
---|
49 | if(UINT32_SIZE EQUAL 4)
|
---|
50 | set(USIZE32 "uint32_t")
|
---|
51 | elseif(SHORT_SIZE EQUAL 4)
|
---|
52 | set(USIZE32 "unsigned short")
|
---|
53 | elseif(INT_SIZE EQUAL 4)
|
---|
54 | set(USIZE32 "unsigned int")
|
---|
55 | elseif(LONG_SIZE EQUAL 4)
|
---|
56 | set(USIZE32 "unsigned long")
|
---|
57 | elseif(U_INT_SIZE EQUAL 4)
|
---|
58 | set(USIZE32 "u_int32_t")
|
---|
59 | else()
|
---|
60 | message(FATAL_ERROR "No unsigned 32 bit type found on this platform!")
|
---|
61 | endif()
|
---|
62 |
|
---|
63 | if(INT64_SIZE EQUAL 8)
|
---|
64 | set(SIZE64 "int64_t")
|
---|
65 | elseif(INT_SIZE EQUAL 8)
|
---|
66 | set(SIZE64 "int")
|
---|
67 | elseif(LONG_SIZE EQUAL 8)
|
---|
68 | set(SIZE64 "long")
|
---|
69 | elseif(LONG_LONG_SIZE EQUAL 8)
|
---|
70 | set(SIZE64 "long long")
|
---|
71 | else()
|
---|
72 | message(FATAL_ERROR "No 64 bit type found on this platform!")
|
---|
73 | endif()
|
---|