From 22267b7797340d1eb52ced10fe05afeb8a42fc2b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 1 Oct 2019 14:21:17 +0200 Subject: When building with clang-cl, nevertheless use MSVC's CXXFLAGS_CXX11 for CLR ...which is built with MSVC after all. 0a99b5a1b7325454fe3d1174d44354888aa22012 "When building with clang-cl on Windows, build CLR code with MSVC" had happened to get away with passing a bogus -Xclang -std=... (which cl then ignores) instead of /std:c++17, but nowadays the build fails with things like > [build CLR] cli_ure/source/climaker/climaker_app.cxx [...] > cl : Command line warning D9002 : ignoring unknown option '-Xclang' > cl : Command line warning D9002 : ignoring unknown option '-std=gnu++2a' > string_view is only available with C++17 or later. > include\rtl/stringconcat.hxx(232): error C2429: attribute 'nodiscard' requires compiler flag '/std:c++17' [...] This is a bit of a hack, using hardcoded values for now. Ideally we would capture MSVC's CXXFLAGS_CXX11 in an additional variable in configure.ac, and do a subst from CXXFLAGS_CXX11 to MSVC's CXXFLAGS_CXX11 here. Change-Id: Ifde367c7d1c3db57e75a6ccadc82d534bcb13d0a Reviewed-on: https://gerrit.libreoffice.org/79961 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- solenv/gbuild/platform/com_MSC_defs.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk index f94ce967bced..8a3bda2cb6a2 100644 --- a/solenv/gbuild/platform/com_MSC_defs.mk +++ b/solenv/gbuild/platform/com_MSC_defs.mk @@ -282,7 +282,11 @@ gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL) # When compiling for CLR, disable "warning C4339: use of undefined type detected # in CLR meta-data - use of this type may lead to a runtime exception": -gb_CXXCLRFLAGS := $(gb_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \ +gb_CXXCLRFLAGS := \ + $(if $(COM_IS_CLANG), \ + $(patsubst -std=%,-std:c++17 -Zc:__cplusplus,$(gb_CXXFLAGS)), \ + $(gb_CXXFLAGS)) \ + $(gb_LinkTarget_EXCEPTIONFLAGS) \ -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ -EHa \ -clr \ -- cgit v1.2.3