FTXUI/examples/CMakeLists.txt
Marc 896c0f2f6e
Casting and documentation fixes (#608)
Add `-wDocumentation` option. Fix the documentation.
Fix c++20/c++17 confusion in tests.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2023-03-31 17:13:48 +02:00

31 lines
890 B
CMake

if(NOT FTXUI_BUILD_EXAMPLES)
return()
endif()
set(EXAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR})
function(example name)
add_executable(ftxui_example_${name} ${name}.cpp)
target_link_libraries(ftxui_example_${name} PUBLIC ${DIRECTORY_LIB})
file(RELATIVE_PATH dir ${EXAMPLES_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set_property(GLOBAL APPEND PROPERTY FTXUI::EXAMPLES ${dir}/${name})
set_target_properties(ftxui_example_${name} PROPERTIES
CXX_STANDARD 17
)
endfunction(example)
add_subdirectory(component)
add_subdirectory(dom)
if (EMSCRIPTEN)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -s ALLOW_MEMORY_GROWTH=1")
target_link_options(component PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1")
get_property(EXAMPLES GLOBAL PROPERTY FTXUI::EXAMPLES)
foreach(file
"index.html"
"sw.js"
"run_webassembly.py")
configure_file(${file} ${file})
endforeach(file)
endif()