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.
This commit is contained in:
Brad King
2020-01-31 14:33:04 -05:00
parent 6348ffb9e5
commit 97de48b528

View File

@@ -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
)