Исправлена область видимости переменных
This commit is contained in:
parent
ec1d917195
commit
63c433a82e
@ -20,21 +20,20 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
|
||||
endmacro()
|
||||
|
||||
function(cmlib_set_cxx_standard version)
|
||||
|
||||
# Выбор стандарта по умолчанию (можно переопределить в проекте)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES PARENT_SCOPE)
|
||||
|
||||
if(version STREQUAL "11")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
if(version EQUAL 11)
|
||||
set(CMAKE_CXX_STANDARD 11 PARENT_SCOPE)
|
||||
set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(version STREQUAL "14")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
if(version EQUAL 14)
|
||||
set(CMAKE_CXX_STANDARD 14 PARENT_SCOPE)
|
||||
set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(version STREQUAL "17")
|
||||
if(version EQUAL 17)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
check_cxx_compiler_flag(-std=gnu++17 HAVE_FLAG_STD_GNUXX17)
|
||||
if(HAVE_FLAG_STD_GNUXX17)
|
||||
@ -56,8 +55,8 @@ function(cmlib_set_cxx_standard version)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
|
||||
set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user