Update CMake usage to enable C++17 (#156)

The target_compile_features command allows setting PUBLIC compile features for the library, making it implicit for the applications linking it. This reduces the CMake boilerplate required to set up a dependent project (eg. ftxui-starter).
This commit is contained in:
Tushar Maheshwari
2021-07-17 12:46:02 +05:30
committed by GitHub
parent a56bb50807
commit 5ee4ec40de
7 changed files with 2 additions and 10 deletions

View File

@@ -16,5 +16,4 @@ if (NOT WIN32)
target_include_directories(ftxui_benchmark
PRIVATE src
)
set_property(TARGET ftxui_benchmark PROPERTY CXX_STANDARD 17)
endif()

View File

@@ -10,8 +10,8 @@ function(ftxui_set_options library)
src
)
# C++17 is used. We requires fold expression at least.
set_property(TARGET ${library} PROPERTY CXX_STANDARD 17)
# C++17 is used. We require fold expression at least.
target_compile_features(${library} PUBLIC cxx_std_17)
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
# to the library and the library users.

View File

@@ -36,7 +36,6 @@ target_include_directories(tests
)
target_compile_options(tests PRIVATE -fsanitize=address)
target_link_libraries(tests PRIVATE -fsanitize=address)
set_property(TARGET tests PROPERTY CXX_STANDARD 17)
if (NOT MSVC)
include(cmake/ftxui_benchmark.cmake)