From efa5cd9840e9f956b229d90953a9ac13849bf7be Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:57:51 -0300 Subject: [PATCH] CMake: checks if we have C++ compiler before setting standard --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 722d944e..01518aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(${CMAKE_CXX_COMPILER} NOT STREQUAL "") + set(CMAKE_CXX_STANDARD 17) +endif(${CMAKE_CXX_COMPILER} NOT STREQUAL "") if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja") # some LSP servers expect compile_commands.json in the project root