xo-indentlog: streamline build for examples

This commit is contained in:
Roland Conybeare 2024-05-30 16:35:01 -04:00
commit 25039f88e8
7 changed files with 42 additions and 25 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
# emacs projectile config
.projectile
# symlink to ${my_build_directory}/compile_commands.json to make LSP work
compile_commands.json
# lsp keeps state here

View file

@ -7,19 +7,15 @@ project(indentlog VERSION 1.0)
include(GNUInstallDirs)
include(cmake/xo-bootstrap-macros.cmake)
xo_cxx_toplevel_options2()
xo_cxx_toplevel_options3()
# ----------------------------------------------------------------
# cmake -DCMAKE_BUILD_TYPE=debug
xo_toplevel_debug_config2()
# c++ settings
# ----------------------------------------------------------------
# cmake -DCMAKE_BUILD_TYPE=asan
xo_toplevel_asan_config2()
# ----------------------------------------------------------------
# cmake -DCMAKE_BUILD_TYPE=coverage
xo_toplevel_coverage_config2()
# one-time project-specific c++ flags. usually empty
#set(PROJECT_CXX_FLAGS "-Wstringop-overread")
#set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
add_definitions(${PROJECT_CXX_FLAGS})
# ----------------------------------------------------------------
@ -35,9 +31,18 @@ xo_install_library4(${SELF_LIB} ${PROJECT_NAME}Targets)
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
# ----------------------------------------------------------------
# docs targets depend on all the other library/utest targets
#
#add_subdirectory(docs)
# ----------------------------------------------------------------
if (XO_ENABLE_EXAMPLES)
install(TARGETS hello DESTINATION bin/indentlog/example)
install(TARGETS indentlog_ex1 DESTINATION bin/indentlog/example)
install(TARGETS indentlog_ex2 DESTINATION bin/indentlog/example)
install(TARGETS indentlog_ex3 DESTINATION bin/indentlog/example)
install(TARGETS indentlog_ex4 DESTINATION bin/indentlog/example)
endif()
# end CMakeLists.txt

View file

@ -1,2 +1,4 @@
if (XO_ENABLE_EXAMPLES)
add_executable(indentlog_ex1 ex1.cpp)
xo_include_options2(indentlog_ex1)
endif()

View file

@ -1,4 +1,6 @@
# NOTE: need target names to be globally unique within the xo umbrella
if (XO_ENABLE_EXAMPLES)
add_executable(indentlog_ex2 ex2.cpp)
xo_include_options2(indentlog_ex2)
endif()

View file

@ -1,2 +1,4 @@
if (XO_ENABLE_EXAMPLES)
add_executable(indentlog_ex3 ex3.cpp)
xo_include_options2(indentlog_ex3)
endif()

View file

@ -1,2 +1,4 @@
if (XO_ENABLE_EXAMPLES)
add_executable(indentlog_ex4 ex4.cpp)
xo_include_options2(indentlog_ex4)
endif()

View file

@ -1,2 +1,4 @@
if (XO_ENABLE_EXAMPLES)
add_executable(hello hello.cpp)
xo_include_options2(hello)
endif()