1 add_custom_target(libc_loader_tests)
3 # A rule to add loader tests. When we have a complete loader, we should
4 # be able to use the add_libc_unittest rule or an extension of it. But,
5 # while the loader is getting built, we need to use a special rule like
7 function(add_loader_test target_name)
8 if(NOT CMAKE_HOST_UNIX)
11 "Loader tests currently assume a POSIX/Unix like environment and "
12 "may not work on your platform.")
15 cmake_parse_arguments(
17 "" # No option arguments
18 "SRC" # Single value arguments
19 "DEPENDS;ARGS;ENV" # Multivalue arguments.
23 get_fq_target_name(${target_name} fq_target_name)
27 ${ADD_LOADER_TEST_SRC}
30 set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
32 target_include_directories(
37 ${LIBC_BUILD_DIR}/include
40 if(ADD_LOADER_TEST_DEPENDS)
41 get_fq_deps_list(fq_deps_list ${ADD_LOADER_TEST_DEPENDS})
42 add_dependencies(${fq_target_name} ${fq_deps_list})
43 get_object_files_for_test(link_object_files has_skipped_entrypoint_list ${fq_deps_list})
44 target_link_libraries(${fq_target_name} ${link_object_files})
54 TARGET ${fq_target_name}
56 COMMAND ${ADD_LOADER_TEST_ENV} $<TARGET_FILE:${fq_target_name}> ${ADD_LOADER_TEST_ARGS}
59 add_dependencies(libc_loader_tests ${fq_target_name})
60 endfunction(add_loader_test)
62 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
63 add_subdirectory(${LIBC_TARGET_OS})