Skip to content

Commit ec199cc

Browse files
committed
Moved PROJECT line to beginning of cmakelists. Fixes #848. Compile as C++ 20 on Windows so that vulkan-hpp pulls in the correct <version> header rather than the deprecated <ciso646> which causes warnings. Fixes #843.
1 parent 1dd9cac commit ec199cc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.20)
2+
project(ngscopeclient VERSION 0.1)
23
include_directories(cmake) #WORKAROUND needed for find_package(Vulkan) for Vulkan SDK
34
enable_language(CXX)
45

@@ -22,8 +23,6 @@ if(DEFINED ENV{VULKAN_SDK})
2223
endif()
2324
endif()
2425

25-
project(ngscopeclient VERSION 0.1)
26-
2726
# Git is used for git-describe based version generation if we have it
2827
find_package(Git)
2928

@@ -48,7 +47,16 @@ set(BUILD_DEVDOCS CACHE BOOL "Build developer documentation")
4847
set(ANALYZE CACHE BOOL "Run static analysis on the code, requires cppcheck and clang-analyzer to be installed")
4948
set(DISABLE_PCH CACHE BOOL "Disable precompiled headers as this may break certain configurations")
5049

51-
set(CMAKE_CXX_STANDARD 17)
50+
# Build with C++ 17 on Linux for maximum compatibility with older system
51+
# but for Windows, enable C++ 20 to bypass a deprecation warning
52+
# (workaround for https://github.com/KhronosGroup/Vulkan-Hpp/issues/2034)
53+
# even though we do not yet use any C++ 20 features in our codebase
54+
if(WIN32)
55+
set(CMAKE_CXX_STANDARD 20)
56+
else()
57+
set(CMAKE_CXX_STANDARD 17)
58+
endif()
59+
5260
set(CMAKE_CXX_STANDARD_REQUIRED ON) # error if compiler doesn't support c++17
5361
set(CMAKE_CXX_EXTENSIONS OFF) # use c++17 instead of gnu++17
5462

0 commit comments

Comments
 (0)