<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 3640842df23de476506d1529caf1736052dbcb38 Mon Sep 17 00:00:00 2001
From: "William R. Dieter" &lt;william.r.dieter@intel.com&gt;
Date: Fri, 24 Jun 2022 21:46:19 -0700
Subject: Tests: Update ModuleDefinition for IntelLLVM MSVC Frontend Variant

IntelLLVM for MSVC uses the compiler for linking.  The /DEF flag needs
to be passed to the linker, and the compiler does not accept it, unless
it is prefixed with `/Qoption,link,`.

Rather than explicitly set the LINK_FLAGS target property, as is done
for other MSVC frontend variants, add the .def file to the sources
for `add_library`.  `add_library` will wrap the `/DEF` flag using
`CMAKE_${lang}_LINKER_WRAPPER_FLAG`.  Presumably, this should work
for any MSVC front end, but leave the original test to avoid changing
a test that is working.

Signed-off-by: William R. Dieter &lt;william.r.dieter@intel.com&gt;
---
 Tests/ModuleDefinition/CMakeLists.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt
index 567fb4b..483bd8b 100644
--- a/Tests/ModuleDefinition/CMakeLists.txt
+++ b/Tests/ModuleDefinition/CMakeLists.txt
@@ -15,7 +15,17 @@ add_custom_command(OUTPUT example_dll_gen.def
 add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def)
 
 # Test /DEF:&lt;file&gt; flag recognition for VS.
-if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel")
+if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
+  # IntelLLVM for MSVC frontend variant needs the /DEF flag wrapped to be sent
+  # to the linker, which happens automatically when the DEF file is added
+  # to the sources.
+  add_library(example_dll_2 SHARED
+    example_dll_2.c
+    "${ModuleDefinition_SOURCE_DIR}/example_dll_2.def"
+    )
+  set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2)
+  set(example_dll_2 example_dll_2)
+elseif(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel")
   add_library(example_dll_2 SHARED example_dll_2.c)
   set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS
     /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def")
-- 
cgit v0.12

</pre></body></html>