sdktool/CMake: Use C++17 to fix build (std::optional)

std::optional is C++17, so the build with master as of commit
6a811936d8 on Debian testing
(amd64, GCC 9) previously failed as follows:

[ 86%] Building CXX object src/tools/sdktool/CMakeFiles/sdktool.dir/sdktool_autogen/mocs_compilation.cpp.o
    cc1plus: warning: <<SRCDIR>>/src/libs/3rdparty/syntax-highlighting/CMakeFiles/QtCreatorPchConsole.dir/cmake_pch.hxx.gch: not used because `__cpp_nontype_template_parameter_auto' not defined [-Winvalid-pch]
    In file included from <<SRCDIR>>/src/libs/utils/environment.h:32,
                     from <<SRCDIR>>/src/libs/utils/qtcprocess.h:28,
                     from <<SRCDIR>>/src/tools/sdktool/sdktool_autogen/YAZZEVSBVD/moc_qtcprocess.cpp:10,
                     from <<SRCDIR>>/src/tools/sdktool/sdktool_autogen/mocs_compilation.cpp:2:
    <<SRCDIR>>/src/libs/utils/optional.h:44:12: error: ‘std::optional’ has not been declared
       44 | using std::optional;
          |            ^~~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:45:12: error: ‘std::nullopt’ has not been declared
       45 | using std::nullopt;
          |            ^~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:46:12: error: ‘std::nullopt_t’ has not been declared
       46 | using std::nullopt_t;
          |            ^~~~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:47:12: error: ‘std::in_place’ has not been declared
       47 | using std::in_place;
          |            ^~~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:51:11: error: ‘optional’ does not name a type
       51 | constexpr optional<std::decay_t<T>> make_optional(T &&v)
          |           ^~~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:57:1: error: ‘optional’ does not name a type
       57 | optional<T> make_optional(Args &&... args)
          | ^~~~~~~~
    <<SRCDIR>>/src/libs/utils/optional.h:63:11: error: ‘optional’ does not name a type
       63 | constexpr optional<T> make_optional(std::initializer_list<Up> il, Args &&... args)
          |           ^~~~~~~~
    In file included from <<SRCDIR>>/src/libs/utils/qtcprocess.h:28,
                     from <<SRCDIR>>/src/tools/sdktool/sdktool_autogen/YAZZEVSBVD/moc_qtcprocess.cpp:10,
                     from <<SRCDIR>>/src/tools/sdktool/sdktool_autogen/mocs_compilation.cpp:2:
    <<SRCDIR>>/src/libs/utils/environment.h:100:12: error: ‘optional’ does not name a type
      100 |     static optional<EnvironmentProvider> provider(const QByteArray &id);
          |            ^~~~~~~~
    make[2]: *** [src/tools/sdktool/CMakeFiles/sdktool.dir/build.make:65: src/tools/sdktool/CMakeFiles/sdktool.dir/sdktool_autogen/mocs_compilation.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:14801: src/tools/sdktool/CMakeFiles/sdktool.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2

Change-Id: Icf33f04147ebf22db803be480f9be052508adec6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Michael Weghorn
2020-07-15 14:57:45 +02:00
parent 6a811936d8
commit f01ed3e1a2

View File

@@ -7,7 +7,7 @@ project(sdktool)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)