list(APPEND test_SOURCES ${CMAKE_SOURCE_DIR}/src/config.cpp ${CMAKE_SOURCE_DIR}/src/utils.cpp ${CMAKE_SOURCE_DIR}/src/cpu.cpp ${CMAKE_SOURCE_DIR}/src/pacmanconf_repo.cpp ${CMAKE_SOURCE_DIR}/src/initcpio.cpp ${CMAKE_SOURCE_DIR}/src/chwd_profiles.cpp ${CMAKE_SOURCE_DIR}/src/disk.cpp ${CMAKE_SOURCE_DIR}/src/drivers.cpp ${CMAKE_SOURCE_DIR}/src/widgets.cpp ${CMAKE_SOURCE_DIR}/src/follow_process_log.cpp ${CMAKE_SOURCE_DIR}/src/crypto.cpp ${CMAKE_SOURCE_DIR}/src/misc.cpp ${CMAKE_SOURCE_DIR}/src/simple_tui.cpp ${CMAKE_SOURCE_DIR}/src/tui.cpp ) add_library(test_libreq STATIC ${test_SOURCES}) target_include_directories(test_libreq PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_DIR}) target_link_libraries(test_libreq PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::component range-v3::range-v3 ctre::ctre tomlplusplus::tomlplusplus) if(NOT ENABLE_DEVENV) target_link_libraries(test_libreq PRIVATE cpr::cpr) endif() ############################################################################# # one executable for each unit test file ############################################################################# file(GLOB files unit-*.cpp) foreach(file ${files}) get_filename_component(file_basename ${file} NAME_WE) string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename}) add_executable(${testcase} ${file}) target_compile_options(${testcase} PRIVATE $<$>:-Wno-deprecated;-Wno-float-equal> $<$:-Wno-deprecated-declarations> ) target_include_directories(${testcase} PRIVATE ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_DIR}) target_link_libraries(${testcase} PRIVATE project_warnings project_options test_libreq spdlog::spdlog fmt::fmt ftxui::component range-v3::range-v3 ctre::ctre tomlplusplus::tomlplusplus) if(NOT ENABLE_DEVENV) target_link_libraries(${testcase} PRIVATE cpr::cpr) endif() endforeach()