43 lines
1.7 KiB
CMake
43 lines
1.7 KiB
CMake
# module-list
|
|
set(yLT_ALL_PROJECTS "struct_pack;struct_pb;struct_json;struct_xml;struct_yaml;coro_rpc;easylog;coro_http;coro_file")
|
|
# separate
|
|
option(Build_ylt_struct_pack "Build struct_pack" ON)
|
|
option(Build_ylt_struct_pb "Build struct_pb" ON)
|
|
option(Build_ylt_struct_json "Build struct_json" ON)
|
|
option(Build_ylt_struct_xml "Build struct_xml" ON)
|
|
option(Build_ylt_struct_yaml "Build struct_yaml" ON)
|
|
option(Build_ylt_coro_rpc "Build coro_rpc" ON)
|
|
option(Build_ylt_easylog "Build easylog" ON)
|
|
option(Build_ylt_coro_http "Build coro_http" ON)
|
|
option(Build_ylt_coro_file "Build coro_file" ON)
|
|
|
|
foreach (proj ${yLT_ALL_PROJECTS})
|
|
set(build_proj "Build_ylt_${proj}")
|
|
if (${build_proj})
|
|
list(APPEND yLT_ENABLE_PROJECTS ${proj})
|
|
endif ()
|
|
endforeach ()
|
|
|
|
message(STATUS "yLT_ENABLE_PROJECTS: ${yLT_ENABLE_PROJECTS}")
|
|
|
|
foreach (module ${yLT_ENABLE_PROJECTS})
|
|
set(module_location ${yaLanTingLibs_SOURCE_DIR}/src/${module})
|
|
if (EXISTS ${module_location})
|
|
add_subdirectory(${module_location})
|
|
if ("${yaLanTingLibs_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
if (BUILD_UNIT_TESTS AND EXISTS "${module_location}/tests")
|
|
message(STATUS "ylt_add_tests_${module}")
|
|
add_subdirectory(${module_location}/tests)
|
|
endif ()
|
|
if (BUILD_BENCHMARK AND EXISTS "${module_location}/benchmark")
|
|
message(STATUS "ylt_add_benchmark_${module}")
|
|
add_subdirectory(${module_location}/benchmark)
|
|
endif ()
|
|
if (BUILD_EXAMPLES AND EXISTS "${module_location}/examples")
|
|
message(STATUS "ylt_add_example_${module}")
|
|
add_subdirectory(${module_location}/examples)
|
|
endif ()
|
|
endif ()
|
|
endif ()
|
|
endforeach ()
|