Skip to content

Commit fc97036

Browse files
author
Rafael Andrioli Bauer
committed
Added static linking flags for MSVC
1 parent ffc5e01 commit fc97036

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎CMakeLists.txt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Redistribution and use of this file is allowed according to the terms of the MIT license.
33
# For details see the LICENSE file distributed with Mimick.
44

5-
cmake_minimum_required (VERSION 2.8)
5+
cmake_minimum_required (VERSION 2.8.12)
66

77
option(BUILD_SHARED_LIBS "Build shared library." OFF)
88
option(BUILD_TESTING "Build tests." OFF)
@@ -19,6 +19,16 @@ OPTION(BUILD_TESTING "Build the tests with ON, defaults to OFF" OFF)
1919

2020
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.cmake")
2121

22+
if(MSVC AND NOT BUILD_SHARED_LIBS)
23+
add_compile_options(/EHsc)
24+
# See https://gitlab.kitware.com/cmake/cmake/-/issues/18390
25+
add_compile_options(
26+
$<$<CONFIG:>:/MT>
27+
$<$<CONFIG:Debug>:/MTd>
28+
$<$<CONFIG:Release>:/MT>
29+
)
30+
endif(MSVC AND NOT BUILD_SHARED_LIBS)
31+
2232
include (CheckSymbolExists)
2333
include (CheckCSourceCompiles)
2434
include (GNUInstallDirs)

0 commit comments

Comments
 (0)