[CMAKE] Do not implicitly link libgcc/stdc++compat to msvcrt

This allows ucrtbase and modules linked to it to be linked to those helper libraries.
This commit is contained in:
Timo Kreuzer 2024-10-22 17:44:27 +03:00
parent b09b5584e0
commit 82ef7b5df1

View file

@ -580,8 +580,8 @@ add_library(libgcc STATIC IMPORTED)
execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libgcc.a OUTPUT_VARIABLE LIBGCC_LOCATION)
string(STRIP ${LIBGCC_LOCATION} LIBGCC_LOCATION)
set_target_properties(libgcc PROPERTIES IMPORTED_LOCATION ${LIBGCC_LOCATION})
# libgcc needs kernel32 imports, winpthread, a CRT and msvcrtex
target_link_libraries(libgcc INTERFACE libwinpthread libkernel32 libmsvcrt msvcrtex)
# libgcc needs kernel32 and winpthread (an appropriate CRT must be linked manually)
target_link_libraries(libgcc INTERFACE libwinpthread libkernel32)
add_library(libsupc++ STATIC IMPORTED GLOBAL)
execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libsupc++.a OUTPUT_VARIABLE LIBSUPCXX_LOCATION)
@ -602,7 +602,7 @@ execute_process(COMMAND ${GXX_EXECUTABLE} -print-file-name=libstdc++.a OUTPUT_VA
string(STRIP ${LIBSTDCCXX_LOCATION} LIBSTDCCXX_LOCATION)
set_target_properties(libstdc++ PROPERTIES IMPORTED_LOCATION ${LIBSTDCCXX_LOCATION})
# libstdc++ requires libsupc++ and mingwex provided by GCC
target_link_libraries(libstdc++ INTERFACE libsupc++ libmingwex)
target_link_libraries(libstdc++ INTERFACE libsupc++ libmingwex oldnames)
# this is for our SAL annotations
target_compile_definitions(libstdc++ INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:PAL_STDCPP_COMPAT>")