Skip to content

Commit 6695b1d

Browse files
committed
Is #7 - add static MT build
1 parent 149e108 commit 6695b1d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,31 @@ include_directories(
179179
Tidy2/NppInterface
180180
)
181181

182+
#------------------------------------------------------------------------
183+
# Static Windows Runtime
184+
# Option to statically link to the Windows runtime. Maybe only
185+
# applies to WIN32/MSVC.
186+
#------------------------------------------------------------------------
187+
if (MSVC)
188+
option( USE_STATIC_RUNTIME "Set ON to change /MD(DLL) to /MT(static)" OFF )
189+
if (USE_STATIC_RUNTIME)
190+
set(CompilerFlags
191+
CMAKE_CXX_FLAGS
192+
CMAKE_CXX_FLAGS_DEBUG
193+
CMAKE_CXX_FLAGS_RELEASE
194+
CMAKE_C_FLAGS
195+
CMAKE_C_FLAGS_DEBUG
196+
CMAKE_C_FLAGS_RELEASE
197+
)
198+
foreach(CompilerFlag ${CompilerFlags})
199+
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
200+
endforeach()
201+
message(STATUS "Using /MT STATIC runtime")
202+
else ()
203+
message(STATUS "Using /MD DYNAMIC runtime")
204+
endif ()
205+
endif ()
206+
182207
### 1 DLL #############################################
183208
# Project [Tidy2], type [Application], 6 C/C++, 12 Hdrs, 0 Other, 0 INCS, 7 DEFS
184209
# File dir [F:\Projects\npptidy2\Tidy2\], out [F:\Projects\npptidy2], rel = [Tidy2\]

0 commit comments

Comments
 (0)