File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.14 )
1+ cmake_minimum_required (VERSION 3.15 )
22
33project (jllama CXX )
44
5+ # Use static MSVC runtime (/MT) instead of the default DLL runtime (/MD).
6+ # This embeds the C++ runtime into jllama.dll so msvcp140.dll / vcruntime140.dll
7+ # are not required on the end-user's machine.
8+ # Must be set before any FetchContent_MakeAvailable() so that llama.cpp and all
9+ # other subprojects inherit the same CRT choice (mixing /MT and /MD in a single
10+ # link is a linker error).
11+ if (MSVC )
12+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG :Debug >:Debug >" CACHE STRING "" FORCE )
13+ endif ()
14+
515include (FetchContent )
616
717set (BUILD_SHARED_LIBS ON )
@@ -273,8 +283,9 @@ if(BUILD_TESTING)
273283 GIT_REPOSITORY https://github.com/google/googletest.git
274284 GIT_TAG v1.15.2
275285 )
276- # Prevent GTest from overriding our compiler/linker settings on Windows
277- set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
286+ # Keep GTest on the same CRT as the rest of the project.
287+ # OFF means GTest respects CMAKE_MSVC_RUNTIME_LIBRARY (static /MT here).
288+ set (gtest_force_shared_crt OFF CACHE BOOL "" FORCE )
278289 FetchContent_MakeAvailable (googletest)
279290
280291 enable_testing ()
You can’t perform that action at this time.
0 commit comments