mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-29 06:35:51 +08:00
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:
parent
a56bb50807
commit
5ee4ec40de
@ -16,5 +16,4 @@ if (NOT WIN32)
|
|||||||
target_include_directories(ftxui_benchmark
|
target_include_directories(ftxui_benchmark
|
||||||
PRIVATE src
|
PRIVATE src
|
||||||
)
|
)
|
||||||
set_property(TARGET ftxui_benchmark PROPERTY CXX_STANDARD 17)
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -10,8 +10,8 @@ function(ftxui_set_options library)
|
|||||||
src
|
src
|
||||||
)
|
)
|
||||||
|
|
||||||
# C++17 is used. We requires fold expression at least.
|
# C++17 is used. We require fold expression at least.
|
||||||
set_property(TARGET ${library} PROPERTY CXX_STANDARD 17)
|
target_compile_features(${library} PUBLIC cxx_std_17)
|
||||||
|
|
||||||
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
# Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
|
||||||
# to the library and the library users.
|
# to the library and the library users.
|
||||||
|
@ -36,7 +36,6 @@ target_include_directories(tests
|
|||||||
)
|
)
|
||||||
target_compile_options(tests PRIVATE -fsanitize=address)
|
target_compile_options(tests PRIVATE -fsanitize=address)
|
||||||
target_link_libraries(tests PRIVATE -fsanitize=address)
|
target_link_libraries(tests PRIVATE -fsanitize=address)
|
||||||
set_property(TARGET tests PROPERTY CXX_STANDARD 17)
|
|
||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
include(cmake/ftxui_benchmark.cmake)
|
include(cmake/ftxui_benchmark.cmake)
|
||||||
|
@ -83,9 +83,6 @@ target_link_libraries(ftxui-starter
|
|||||||
PRIVATE ftxui::component # Not needed for this example.
|
PRIVATE ftxui::component # Not needed for this example.
|
||||||
)
|
)
|
||||||
|
|
||||||
# C++17 is used. We requires fold expressions at least.
|
|
||||||
set_target_properties(ftxui-starter PROPERTIES CXX_STANDARD 17)
|
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Build
|
Build
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
function(example name)
|
function(example name)
|
||||||
add_executable(${name} ${name}.cpp)
|
add_executable(${name} ${name}.cpp)
|
||||||
target_link_libraries(${name} PUBLIC component)
|
target_link_libraries(${name} PUBLIC component)
|
||||||
set_property(TARGET ${name} PROPERTY CXX_STANDARD 17)
|
|
||||||
endfunction(example)
|
endfunction(example)
|
||||||
|
|
||||||
example(button)
|
example(button)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
function(example name)
|
function(example name)
|
||||||
add_executable(${name} ${name}.cpp)
|
add_executable(${name} ${name}.cpp)
|
||||||
target_link_libraries(${name} PUBLIC dom)
|
target_link_libraries(${name} PUBLIC dom)
|
||||||
set_property(TARGET ${name} PROPERTY CXX_STANDARD 17)
|
|
||||||
endfunction(example)
|
endfunction(example)
|
||||||
|
|
||||||
example(border)
|
example(border)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
function(example name)
|
function(example name)
|
||||||
add_executable(${name} ${name}.cpp)
|
add_executable(${name} ${name}.cpp)
|
||||||
target_link_libraries(${name} PUBLIC component)
|
target_link_libraries(${name} PUBLIC component)
|
||||||
set_property(TARGET ${name} PROPERTY CXX_STANDARD 17)
|
|
||||||
endfunction(example)
|
endfunction(example)
|
||||||
|
|
||||||
example(print_key_press)
|
example(print_key_press)
|
||||||
|
Loading…
Reference in New Issue
Block a user