Skip to content

Commit

Permalink
fix: use the latest supported standard instead of forcing C++-11 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Oct 3, 2024
1 parent 46690dd commit 3e8d89d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ endif()

set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_CXX_STANDARD 11)

# if standard not provided, use the latest supported by the compiler
if("${CMAKE_CXX_STANDARD}" STREQUAL "")
function(_set_language_standard output language)
foreach(version IN LISTS ARGN)
if(DEFINED "CMAKE_${language}${version}_STANDARD_COMPILE_OPTION"
OR DEFINED "CMAKE_${language}${version}_EXTENSION_COMPILE_OPTION"
)
set("${output}" "${version}" PARENT_SCOPE)
break()
endif()
endforeach()
endfunction()
_set_language_standard(CMAKE_CXX_STANDARD CXX 20 17 14 11)
endif()

include(GNUInstallDirs)

Expand Down

0 comments on commit 3e8d89d

Please sign in to comment.