AmdisCXXFeatures.cmake 563 Bytes
Newer Older
1
2
include(CheckCXXSourceCompiles)

3
4
set(CMAKE_REQUIRED_FLAGS "-pedantic-errors")

5
6
7
8
9
10
11
12
13
14
15
# fold expressions (a + ...)
check_cxx_source_compiles("
  template <class... Args>
  int f(Args... args)
  {
    return (args + ...);
  }
  int main()
  {
    f(0,1,2,3,4,5);
  }
16
"  AMDIS_HAS_CXX_FOLD_EXPRESSIONS
17
18
)

19
20
21
22
23
24
25
26
27
28
check_cxx_source_compiles("
  #include <iostream>
  #include <tuple>
  int main()
  {
    auto tup = std::make_tuple(0, 'a', 3.14);
    for... (auto elem : tup)
      std::cout << elem << std::endl;
  }
"  AMDIS_HAS_EXPANSION_STATEMENTS
29
30
)

31
unset(CMAKE_REQUIRED_FLAGS)