From 97de48b52899007e3ecfb988bddff8a8d9b70110 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 31 Jan 2020 14:33:04 -0500
Subject: Tests: Update Assembler code generation to select MSVC runtime
 library

The `Assembler` test runs the C compiler in a custom command to generate
a `.s` file for the platform.  When using the GNU-like Clang variant on
Windows, ensure that the custom command includes the MSVC runtime
library selection flags for Clang.  That way the resulting `.s` file,
when assembled into a `.obj`, will tell the linker what runtime library
it needs.
---
 Tests/Assembler/CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index 21b265c..a3c9946 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 3.8)
 project(Assembler C)
 message("CTEST_FULL_OUTPUT ")
 set(CMAKE_VERBOSE_MAKEFILE 1)
@@ -22,7 +22,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND
     set(SRCS main.s)
     add_custom_command(
       OUTPUT main.s
-      COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
+      COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS}
+        "$<$<CONFIG:Debug>:${CMAKE_C_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL}>"
+        "$<$<NOT:$<CONFIG:Debug>>:${CMAKE_C_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL}>"
+        -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
+      COMMAND_EXPAND_LISTS
       DEPENDS main.c
       VERBATIM
       )
-- 
cgit v0.12