base: enable test in cmake based build

This commit is contained in:
Corentin Le Molgat
2025-01-22 13:52:06 +01:00
parent 8a074c486a
commit 8bb762f852

View File

@@ -40,3 +40,22 @@ target_link_libraries(${NAME} PRIVATE
protobuf::libprotobuf
${PROJECT_NAMESPACE}::ortools_proto)
#add_library(${PROJECT_NAMESPACE}::base ALIAS ${NAME})
if(BUILD_TESTING)
file(GLOB _TEST_SRCS "*_test.cc")
foreach(_FULL_FILE_NAME IN LISTS _TEST_SRCS)
get_filename_component(_NAME ${_FULL_FILE_NAME} NAME_WE)
get_filename_component(_FILE_NAME ${_FULL_FILE_NAME} NAME)
ortools_cxx_test(
NAME
base_${_NAME}
SOURCES
${_FILE_NAME}
LINK_LIBRARIES
benchmark::benchmark
GTest::gtest
GTest::gtest_main
GTest::gmock
)
endforeach()
endif()