~ubuntu-branches/ubuntu/trusty/cmake3/trusty-updates

« back to all changes in this revision

Viewing changes to Tests/CompileDefinitions/compiletest.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2017-02-23 17:55:24 UTC
  • Revision ID: package-import@ubuntu.com-20170223175524-5nh7s4pu97fsa0t7
Tags: upstream-3.5.1
ImportĀ upstreamĀ versionĀ 3.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef CMAKE_IS_FUN
 
3
#error Expect CMAKE_IS_FUN definition
 
4
#endif
 
5
 
 
6
#if CMAKE_IS != Fun
 
7
#error Expect CMAKE_IS=Fun definition
 
8
#endif
 
9
 
 
10
 
 
11
template<bool test>
 
12
struct CMakeStaticAssert;
 
13
 
 
14
template<>
 
15
struct CMakeStaticAssert<true> {};
 
16
 
 
17
static const char fun_string[] = CMAKE_IS_;
 
18
#ifndef NO_SPACES_IN_DEFINE_VALUES
 
19
static const char very_fun_string[] = CMAKE_IS_REALLY;
 
20
#endif
 
21
 
 
22
enum {
 
23
  StringLiteralTest1 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_) == sizeof("Fun")>),
 
24
#ifndef NO_SPACES_IN_DEFINE_VALUES
 
25
  StringLiteralTest2 = sizeof(CMakeStaticAssert<sizeof(CMAKE_IS_REALLY) == sizeof("Very Fun")>),
 
26
#endif
 
27
#ifdef TEST_GENERATOR_EXPRESSIONS
 
28
  StringLiteralTest3 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST1) == sizeof("A,B,C,D")>),
 
29
  StringLiteralTest4 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST2) == sizeof("A,,B,,C,,D")>),
 
30
  StringLiteralTest5 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST3) == sizeof("A,-B,-C,-D")>),
 
31
  StringLiteralTest6 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST4) == sizeof("A-,-B-,-C-,-D")>),
 
32
  StringLiteralTest7 = sizeof(CMakeStaticAssert<sizeof(LETTER_LIST5) == sizeof("A-,B-,C-,D")>)
 
33
#endif
 
34
};
 
35
 
 
36
#ifdef TEST_GENERATOR_EXPRESSIONS
 
37
#ifndef CMAKE_IS_DECLARATIVE
 
38
#error Expect declarative definition
 
39
#endif
 
40
#ifdef GE_NOT_DEFINED
 
41
#error Expect not defined generator expression
 
42
#endif
 
43
 
 
44
#ifndef ARGUMENT
 
45
#error Expected define expanded from list
 
46
#endif
 
47
#ifndef LIST
 
48
#error Expected define expanded from list
 
49
#endif
 
50
 
 
51
#ifndef PREFIX_DEF1
 
52
#error Expect PREFIX_DEF1
 
53
#endif
 
54
 
 
55
#ifndef PREFIX_DEF2
 
56
#error Expect PREFIX_DEF2
 
57
#endif
 
58
 
 
59
#ifndef LINK_CXX_DEFINE
 
60
#error Expected LINK_CXX_DEFINE
 
61
#endif
 
62
#ifndef LINK_LANGUAGE_IS_CXX
 
63
#error Expected LINK_LANGUAGE_IS_CXX
 
64
#endif
 
65
 
 
66
#ifdef LINK_C_DEFINE
 
67
#error Unexpected LINK_C_DEFINE
 
68
#endif
 
69
#ifdef LINK_LANGUAGE_IS_C
 
70
#error Unexpected LINK_LANGUAGE_IS_C
 
71
#endif
 
72
 
 
73
 
 
74
// TEST_GENERATOR_EXPRESSIONS
 
75
#endif
 
76
 
 
77
#ifndef BUILD_IS_DEBUG
 
78
# error "BUILD_IS_DEBUG not defined!"
 
79
#endif
 
80
#ifndef BUILD_IS_NOT_DEBUG
 
81
# error "BUILD_IS_NOT_DEBUG not defined!"
 
82
#endif
 
83
 
 
84
// Check per-config definitions.
 
85
#ifdef TEST_CONFIG_DEBUG
 
86
# if !BUILD_IS_DEBUG
 
87
#  error "BUILD_IS_DEBUG false with TEST_CONFIG_DEBUG!"
 
88
# endif
 
89
# if BUILD_IS_NOT_DEBUG
 
90
#  error "BUILD_IS_NOT_DEBUG true with TEST_CONFIG_DEBUG!"
 
91
# endif
 
92
#else
 
93
# if BUILD_IS_DEBUG
 
94
#  error "BUILD_IS_DEBUG true without TEST_CONFIG_DEBUG!"
 
95
# endif
 
96
# if !BUILD_IS_NOT_DEBUG
 
97
#  error "BUILD_IS_NOT_DEBUG false without TEST_CONFIG_DEBUG!"
 
98
# endif
 
99
#endif
 
100
 
 
101
int main(int argc, char **argv)
 
102
{
 
103
  return 0;
 
104
}