-
Notifications
You must be signed in to change notification settings - Fork 8
/
CheckSTLContainers.cmake
47 lines (40 loc) · 1.3 KB
/
CheckSTLContainers.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
# - Macro to check whether the STL containers support incomplete types
# The issue at stake is discussed here in depth:
# http://www.drdobbs.com/the-standard-librarian-containers-of-inc/184403814
#
# Empirically libstdc++ and MSVC++ support containers of incomplete types
# whereas libc++ does not.
#
# The result is returned in HAVE_STL_CONTAINER_INCOMPLETE_TYPES
#
# Copyright 2014 Brian Jensen <Jensen dot J dot Brian at gmail dot com>
# Author: Brian Jensen <Jensen dot J dot Brian at gmail dot com>
#
macro(CHECK_STL_CONTAINERS)
INCLUDE(CheckCXXSourceCompiles)
SET(CMAKE_REQUIRED_FLAGS)
CHECK_CXX_SOURCE_COMPILES("
#include <string>
#include <map>
#include <vector>
class TreeElement;
typedef std::map<std::string, TreeElement> SegmentMap;
class TreeElement
{
TreeElement(const std::string& name): number(0) {}
public:
int number;
SegmentMap::const_iterator parent;
std::vector<SegmentMap::const_iterator> children;
static TreeElement Root(std::string& name)
{
return TreeElement(name);
}
};
int main()
{
return 0;
}
"
HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
endmacro(CHECK_STL_CONTAINERS)