set(ORC_RT_HEADERS
    orc-rt-c/CoreTyspe.h
    orc-rt-c/ExternC.h
    orc-rt-c/WrapperFunction.h
    orc-rt-c/orc-rt.h
    orc-rt/AllocAction.h
    orc-rt/BitmaskEnum.h
    orc-rt/Compiler.h
    orc-rt/Error.h
    orc-rt/ExecutorAddress.h
    orc-rt/IntervalMap.h
    orc-rt/IntervalSet.h
    orc-rt/Math.h
    orc-rt/MemoryFlags.h
    orc-rt/QueueingTaskDispatcher.h
    orc-rt/ResourceManager.h
    orc-rt/RTTI.h
    orc-rt/ScopeExit.h
    orc-rt/Session.h
    orc-rt/SimpleNativeMemoryMap.h
    orc-rt/SimplePackedSerialization.h
    orc-rt/SPSAllocAction.h
    orc-rt/SPSMemoryFlags.h
    orc-rt/SPSWrapperFunction.h
    orc-rt/SPSWrapperFunctionBuffer.h
    orc-rt/TaskDispatcher.h
    orc-rt/ThreadPoolTaskDispatcher.h
    orc-rt/WrapperFunction.h
    orc-rt/bind.h
    orc-rt/bit.h
    orc-rt/move_only_function.h
    orc-rt/span.h
)

# Add generated config header
set(ORC_RT_GENERATED_HEADERS
    ${CMAKE_CURRENT_BINARY_DIR}/orc-rt-c/config.h
)

# TODO: Switch to filesets when we move to cmake-3.23.
add_library(orc-rt-headers INTERFACE)
target_include_directories(orc-rt-headers INTERFACE
    $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
    $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
    $<INSTALL_INTERFACE:include>
)
set_property(TARGET orc-rt-headers
    PROPERTY PUBLIC_HEADER ${ORC_RT_HEADERS} ${ORC_RT_GENERATED_HEADERS}
)
install(TARGETS orc-rt-headers
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/
    COMPONENT OrcRT_Development
)

# Install generated config header
install(FILES ${ORC_RT_GENERATED_HEADERS}
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/orc-rt-c/
    COMPONENT OrcRT_Development
)
