Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake =================================================================== --- compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -139,6 +139,7 @@ # CFLAGS # LINK_FLAGS # DEFS +# DEPS # LINK_LIBS (only for shared library) # OBJECT_LIBS # PARENT_TARGET @@ -151,7 +152,7 @@ cmake_parse_arguments(LIB "" "PARENT_TARGET" - "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS" + "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS" ${ARGN}) set(libnames) # Until we support this some other way, build compiler-rt runtime without LTO @@ -293,6 +294,9 @@ ${COMPONENT_OPTION}) else() add_library(${libname} ${type} ${sources_${libname}}) + if(LIB_DEPS) + add_dependencies(${libname} ${LIB_DEPS}) + endif() set_target_compile_flags(${libname} ${extra_cflags_${libname}}) set_target_link_flags(${libname} ${extra_link_flags_${libname}}) set_property(TARGET ${libname} APPEND PROPERTY Index: compiler-rt/lib/gwp_asan/CMakeLists.txt =================================================================== --- compiler-rt/lib/gwp_asan/CMakeLists.txt +++ compiler-rt/lib/gwp_asan/CMakeLists.txt @@ -15,6 +15,10 @@ # GwpAsan libraries using the Clang C compiler. set(GWP_ASAN_CFLAGS -fno-rtti -fno-exceptions) +if (TARGET cxx-headers OR HAVE_LIBCXX) + set(GWP_ASAN_DEPS cxx-headers) +endif() + if (COMPILER_RT_HAS_GWP_ASAN) foreach(arch ${GWP_ASAN_SUPPORTED_ARCH}) add_compiler_rt_runtime( @@ -24,6 +28,7 @@ SOURCES ${GWP_ASAN_SOURCES} ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS} CFLAGS ${GWP_ASAN_CFLAGS} + DEPS ${GWP_ASAN_DEPS} PARENT_TARGET gwp_asan ) endforeach() @@ -32,5 +37,6 @@ ARCHS ${GWP_ASAN_SUPPORTED_ARCH} SOURCES ${GWP_ASAN_SOURCES} ADDITIONAL_HEADERS ${GWP_ASAN_HEADERS} - CFLAGS ${GWP_ASAN_CFLAGS}) + CFLAGS ${GWP_ASAN_CFLAGS} + DEPS ${GWP_ASAN_DEPS}) endif()