Skip to content

Commit

Permalink
Statically link MSVC runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Jun 17, 2020
1 parent bbbee0a commit 2509219
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
26 changes: 18 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.15)

project(com.fredemmott.micmutetoggle.sdPlugin VERSION 2.4)
# CMAKE_MSVC_RUNTIME_POLICY support
cmake_policy(SET CMP0091 NEW)
# Statically link the MSVC runtime
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

project(
com.fredemmott.micmutetoggle.sdPlugin
VERSION 2.4
LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED true)
set(CMAKE_CXX_EXTENSIONS false)
if (MSVC)
add_definitions("/Zc:__cplusplus -DUNICODE=1")
endif()

if (APPLE)
set(
Expand All @@ -26,12 +42,6 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()
message(STATUS "Install dir: ${CMAKE_INSTALL_PREFIX}")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED true)
set(CMAKE_CXX_EXTENSIONS false)
if (MSVC)
add_definitions("/Zc:__cplusplus -DUNICODE=1")
endif()
include_directories("${CMAKE_SOURCE_DIR}")

include("StreamDeckSDK.cmake")
Expand Down
6 changes: 4 additions & 2 deletions StreamDeckSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ ExternalProject_Add(
URL https://github.com/fredemmott/StreamDeck-CPPSDK/releases/download/v1.0/StreamDeckSDK-v1.0.zip
URL_HASH SHA512=3a2c5e2c0fc7ea4dca6e6a0a36bfe9726bcbbf9248d70bac1542362bcdc395ba26713891082798346a7d17035bba366fae9d6f371c9fcff227ea8d19a23a07c8
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)

ExternalProject_Get_Property(
Expand Down

0 comments on commit 2509219

Please sign in to comment.