This is an automated email from the ASF dual-hosted git repository. kparzysz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push: new 76c5186e15 Enable C++17 for cmake modules (#13869) 76c5186e15 is described below commit 76c5186e15b2453375ca79f81826d0c5cdff4bf6 Author: Egor Churaev <egor.chur...@gmail.com> AuthorDate: Mon Jan 30 18:01:20 2023 +0300 Enable C++17 for cmake modules (#13869) Moved the lines which add c++17 to CXX_FLAGS before the include of modules. After this c++17 features should be also supported in source code of the modules. --- CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 032e0bc2af..a82c640974 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -478,6 +478,17 @@ endif(USE_KALLOC_ALIGNMENT) # need to be re-compiled every time. Using ccache 4.0+ can resolve this issue. include(cmake/utils/CCache.cmake) +include(CheckCXXCompilerFlag) +if(NOT MSVC) + check_cxx_compiler_flag("-std=c++17" SUPPORT_CXX17) + set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}") + set(CMAKE_CUDA_STANDARD 17) +else() + check_cxx_compiler_flag("/std:c++17" SUPPORT_CXX17) + set(CMAKE_CXX_FLAGS "/std:c++17 ${CMAKE_CXX_FLAGS}") + set(CMAKE_CUDA_STANDARD 17) +endif() + # Module rules include(cmake/modules/VTA.cmake) include(cmake/modules/StandaloneCrt.cmake) @@ -525,17 +536,6 @@ include(cmake/modules/Git.cmake) include(cmake/modules/LibInfo.cmake) include(cmake/modules/RustExt.cmake) -include(CheckCXXCompilerFlag) -if(NOT MSVC) - check_cxx_compiler_flag("-std=c++17" SUPPORT_CXX17) - set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}") - set(CMAKE_CUDA_STANDARD 17) -else() - check_cxx_compiler_flag("/std:c++17" SUPPORT_CXX17) - set(CMAKE_CXX_FLAGS "/std:c++17 ${CMAKE_CXX_FLAGS}") - set(CMAKE_CUDA_STANDARD 17) -endif() - set(LIBINFO_FILE ${CMAKE_CURRENT_LIST_DIR}/src/support/libinfo.cc) add_lib_info(${LIBINFO_FILE}) list(REMOVE_ITEM COMPILER_SRCS ${LIBINFO_FILE})