3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-25 19:36:21 +00:00
yosys/tests/unit/CMakeLists.txt
Catherine cad5353a2a Migrate build system to CMake
See #5895 for details.

This commit does not include CI or documentation changes.
2026-05-21 23:50:04 +00:00

25 lines
665 B
CMake

include(CTest)
include(GoogleTest)
function(yosys_gtest arg_TARGET)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "COMPONENTS")
set(arg_SOURCES ${arg_UNPARSED_ARGUMENTS})
set(target "gtest-${arg_TARGET}")
add_executable(${target} ${arg_SOURCES})
target_link_libraries(${target} PRIVATE GTest::gmock_main yosys_common)
yosys_expand_components(test_components essentials ${arg_COMPONENTS})
yosys_link_components(${target} PRIVATE ${test_components})
if(NOT CMAKE_CROSSCOMPILING)
gtest_discover_tests(${target})
endif()
endfunction()
if (GTest_FOUND)
add_subdirectory(kernel)
add_subdirectory(opt)
add_subdirectory(techmap)
enable_testing()
endif()