Исправлена область видимости переменных

This commit is contained in:
Andrei Astafev 2021-05-30 20:53:38 +03:00
parent ec1d917195
commit 63c433a82e

View File

@ -20,21 +20,20 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
endmacro() endmacro()
function(cmlib_set_cxx_standard version) function(cmlib_set_cxx_standard version)
# Выбор стандарта по умолчанию (можно переопределить в проекте) # Выбор стандарта по умолчанию (можно переопределить в проекте)
set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_STANDARD_REQUIRED YES PARENT_SCOPE)
if(version STREQUAL "11") if(version EQUAL 11)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11 PARENT_SCOPE)
set(CMAKE_CXX_EXTENSIONS YES) set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
endif() endif()
if(version STREQUAL "14") if(version EQUAL 14)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14 PARENT_SCOPE)
set(CMAKE_CXX_EXTENSIONS YES) set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
endif() endif()
if(version STREQUAL "17") if(version EQUAL 17)
if(${CMAKE_VERSION} VERSION_LESS "3.10.0") if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
check_cxx_compiler_flag(-std=gnu++17 HAVE_FLAG_STD_GNUXX17) check_cxx_compiler_flag(-std=gnu++17 HAVE_FLAG_STD_GNUXX17)
if(HAVE_FLAG_STD_GNUXX17) if(HAVE_FLAG_STD_GNUXX17)
@ -56,8 +55,8 @@ function(cmlib_set_cxx_standard version)
endif() endif()
endif() endif()
else() else()
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
set(CMAKE_CXX_EXTENSIONS YES) set(CMAKE_CXX_EXTENSIONS YES PARENT_SCOPE)
endif() endif()
endif() endif()
endfunction() endfunction()