1add_custom_target(libc-tool-util-tests) 2 3function(add_libc_tool_unittest target_name) 4 5 cmake_parse_arguments( 6 "LIBC_TOOL_UNITTEST" 7 "" # No optional arguments 8 "" # Single value arguments 9 "SRCS;DEPENDS;ARGS" # Multi-value arguments 10 ${ARGN} 11 ) 12 13 add_executable(${target_name} 14 EXCLUDE_FROM_ALL 15 ${LIBC_TOOL_UNITTEST_SRCS} 16 ) 17 target_link_libraries(${target_name} 18 PRIVATE 19 gtest_main 20 gtest 21 ${LIBC_TOOL_UNITTEST_DEPENDS} 22 ) 23 24 add_custom_command( 25 TARGET ${target_name} 26 POST_BUILD 27 COMMAND $<TARGET_FILE:${target_name}> 28 ${LIBC_TOOL_UNITTEST_ARGS} 29 ) 30 add_dependencies(libc-tool-util-tests ${target_name}) 31 32 target_compile_options(${target_name} PUBLIC -fno-rtti) 33 target_link_libraries(${target_name} PRIVATE LLVMSupport) 34endfunction() 35 36add_subdirectory(WrapperGen) 37