summaryrefslogtreecommitdiffstats
path: root/libgcc/CMakeLists.txt
blob: b5b2abc9d03f71824f728f5e28444e6569c00deb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
macro(setup_crt_object_file object_file target_name)
    execute_process(
        COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=${object_file}
        OUTPUT_STRIP_TRAILING_WHITESPACE
        OUTPUT_VARIABLE PATH
        ERROR_VARIABLE ERROR_MESSAGE
        RESULT_VARIABLE RESULT
    )

    if(RESULT)
        message(FATAL_ERROR ${ERROR_MESSAGE})
    endif()

    add_library(${target_name} OBJECT IMPORTED GLOBAL)
    set_target_properties(${target_name} PROPERTIES
        IMPORTED_OBJECTS ${PATH}
    )

endmacro()

# TODO: set platform specific CRT objects
setup_crt_object_file(crtbegin.o CRTBEGIN)
setup_crt_object_file(crtend.o CRTEND)

add_subdirectory(${ARCH})