From ae491f04a14195322821d565a66c49b68d238b32 Mon Sep 17 00:00:00 2001 From: Justin Lewis Date: Tue, 31 Aug 2021 05:07:49 -0500 Subject: [PATCH] Fixes build issue with LLVM on Windows with cmake (#10776) LLVM fails to build on Windows with C++ 20 standard. When building LLVM on Windows, we use C++ 14 already. This commit changes the c++ standard to be picked by each subdirectory rather than the standard being picked by the root level cmake file. --- 3rdparty/CMakeLists.txt | 2 ++ CMakeLists.txt | 1 - rpcs3/CMakeLists.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 402c0cddfc..d5bea616c9 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -2,6 +2,8 @@ find_package(PkgConfig) include(ExternalProject) include(CMakeDependentOption) +set(CMAKE_CXX_STANDARD 20) + # Dummy target to use when lib isn't available add_library(3rdparty_dummy_lib INTERFACE) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bced56586..f9b18ef691 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,6 @@ option(USE_PRECOMPILED_HEADERS "Use precompiled headers" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/buildfiles/cmake") -set(CMAKE_CXX_STANDARD 20) include(CheckCXXCompilerFlag) if(NOT CMAKE_BUILD_TYPE) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index fc4aa0aa4f..7a63931362 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -10,6 +10,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake) include(ConfigureCompiler) include(CheckFunctionExists) +set(CMAKE_CXX_STANDARD 20) + set(ADDITIONAL_LIBS "") if(CMAKE_SYSTEM MATCHES "Linux") #on some Linux distros shm_unlink and similar functions are in librt only