Set static build properly on non-Windows vcpkg targets
This commit is contained in:
@@ -32,26 +32,26 @@ include(CPack)
|
|||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
# Basic build options
|
# Basic build options
|
||||||
if(WIN32)
|
if(VCPKG_TOOLCHAIN)
|
||||||
if(VCPKG_TOOLCHAIN)
|
# For vcpkg builds we have to respect the linking method used by the
|
||||||
# For vcpkg builds we have to respect the linking method used by the
|
# specified triplet.
|
||||||
# specified triplet.
|
set(NO_STATIC_OPTION ON)
|
||||||
set(NO_STATIC_OPTION ON)
|
if(VCPKG_TARGET_TRIPLET MATCHES "-static$")
|
||||||
if(VCPKG_TARGET_TRIPLET MATCHES "-windows-static$")
|
# `-static` triplet, use static linking
|
||||||
# `-static` triplet, use static linking
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set(STATIC_BUILD ON)
|
||||||
set(STATIC_BUILD ON)
|
elseif(VCPKG_TARGET_TRIPLET MATCHES "-static-md$")
|
||||||
elseif(VCPKG_TARGET_TRIPLET MATCHES "-windows-static-md$")
|
# `-static-md` triplet, use static linking with dynamic CRT
|
||||||
# `-static-md` triplet, use static linking with dynamic CRT
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
set(STATIC_BUILD ON)
|
||||||
set(STATIC_BUILD ON)
|
elseif()
|
||||||
elseif()
|
# Regular triplet, use dynamic linking
|
||||||
# Regular triplet, use dynamic linking
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
set(STATIC_BUILD OFF)
|
||||||
set(STATIC_BUILD OFF)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
# Prefer static builds on Windows
|
# Prefer static builds on Windows
|
||||||
set(PREFER_STATIC ON)
|
set(PREFER_STATIC ON)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user