llvm-project/libc/test/utils/tools/CMakeLists.txt
Siva Chandra Reddy 9ab6c1a99f [libc] Let wrappergen pick LLVM libc mangled name from aliasee file.
Along the way, made a change to run tool unittests when the target
"check-libc" is run by introducing a libc testsuite for tool unittests.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D93142
2020-12-11 14:33:03 -08:00

37 lines
835 B
CMake

add_libc_testsuite(libc-tool-unittests)
function(add_libc_tool_unittest target_name)
cmake_parse_arguments(
"LIBC_TOOL_UNITTEST"
"" # No optional arguments
"" # Single value arguments
"SRCS;DEPENDS;ARGS" # Multi-value arguments
${ARGN}
)
add_executable(${target_name}
EXCLUDE_FROM_ALL
${LIBC_TOOL_UNITTEST_SRCS}
)
target_link_libraries(${target_name}
PRIVATE
gtest_main
gtest
${LIBC_TOOL_UNITTEST_DEPENDS}
)
add_custom_command(
TARGET ${target_name}
POST_BUILD
COMMAND $<TARGET_FILE:${target_name}>
${LIBC_TOOL_UNITTEST_ARGS}
)
add_dependencies(libc-tool-unittests ${target_name})
target_compile_options(${target_name} PUBLIC -fno-rtti)
target_link_libraries(${target_name} PRIVATE LLVMSupport)
endfunction()
add_subdirectory(WrapperGen)