Use globally set CMAKE_CXX_STANDARD if it is set (#620)

This commit is contained in:
Jason Turner 2023-04-17 14:17:48 -06:00 committed by GitHub
parent 1397c10234
commit e23dbc7473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,9 +43,17 @@ function(ftxui_set_options library)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
) )
# Play nicely if we are being consumed by another project
# and use their CMAKE_CXX_STANDARD. Otherwise, fall back to 17
# C++17 is used. We require fold expression at least. # C++17 is used. We require fold expression at least.
if (DEFINED CMAKE_CXX_STANDARD)
set(CXX_STANDARD ${CMAKE_CXX_STANDARD})
else()
set(CXX_STANDARD 17)
endif()
set_target_properties(${library} PROPERTIES set_target_properties(${library} PROPERTIES
CXX_STANDARD 17 CXX_STANDARD ${CXX_STANDARD}
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
) )