summaryrefslogtreecommitdiff
path: root/cmake/modules/CheckCxxHashmap.cmake
blob: 5f16c0ac4418350c1629f07bab9dbf8ccc238326 (plain)
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
# - Check if for hash_map.
# CHECK_HASHMAP ()
#

include(CheckCXXSourceCompiles)

macro(CHECK_HASHMAP)
  message(STATUS "Checking for C++ hash_map implementation...")
  check_cxx_source_compiles("
		#include <ext/hash_map>
		int main() {
			__gnu_cxx::hash_map<int, int> t;
		}
"
    HAVE_GNU_EXT_HASH_MAP
    )
  if(HAVE_GNU_EXT_HASH_MAP)
    message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::")
  endif(HAVE_GNU_EXT_HASH_MAP)

  check_cxx_source_compiles("
		#include <ext/hash_map>
		int main() {
			std::hash_map<int, int> t;
		}
"
    HAVE_STD_EXT_HASH_MAP
    )
  if(HAVE_STD_EXT_HASH_MAP)
    message(STATUS "C++ hash_map found in 'ext' dir in namespace std::")
  endif(HAVE_STD_EXT_HASH_MAP)

  check_cxx_source_compiles("
		#include <hash_map>
		int main() {
			hash_map<int, int> t;
		}
"
    HAVE_GLOBAL_HASH_MAP
    )
  if(HAVE_GLOBAL_HASH_MAP)
    message(STATUS "C++ hash_map found in global namespace")
  endif(HAVE_GLOBAL_HASH_MAP)

  if(NOT HAVE_GNU_EXT_HASH_MAP)
    if(NOT HAVE_STD_EXT_HASH_MAP)
      if(NOT HAVE_GLOBAL_HASH_MAP)
	message(STATUS "C++ hash_map not found")
      endif(NOT HAVE_GLOBAL_HASH_MAP)
    endif(NOT HAVE_STD_EXT_HASH_MAP)
  endif(NOT HAVE_GNU_EXT_HASH_MAP)

endmacro(CHECK_HASHMAP)