1
2add_host_module(gcc_plugin_seh main.cpp)
3target_include_directories(gcc_plugin_seh PRIVATE ${GCC_PLUGIN_DIR}/include)
4set_target_properties(gcc_plugin_seh PROPERTIES POSITION_INDEPENDENT_CODE ON)
5
6if (CMAKE_HOST_SYSTEM MATCHES "Windows")
7    # On windows, GCC plugins need to be linked to the main executable
8    # This means that there must be a plugin for both GCC & G++
9    target_link_libraries(gcc_plugin_seh PRIVATE ${GCC_PLUGIN_DIR}/cc1.exe.a)
10    add_host_module(g++_plugin_seh $<TARGET_OBJECTS:gcc_plugin_seh>)
11    target_link_libraries(g++_plugin_seh PRIVATE ${GCC_PLUGIN_DIR}/cc1plus.exe.a)
12endif()
13