Browse Source

pnnx static msvc crt option

tags/20220420
nihui 4 years ago
parent
commit
0f2f25f0af
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      tools/pnnx/CMakeLists.txt

+ 14
- 1
tools/pnnx/CMakeLists.txt View File

@@ -2,7 +2,20 @@ project(pnnx)
cmake_minimum_required(VERSION 3.12)

if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0074 NEW)
endif()

if(NOT CMAKE_VERSION VERSION_LESS "3.15")
# enable CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
endif()

if(MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.15")
option(PNNX_BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked ncnn" OFF)
if(PNNX_BUILD_WITH_STATIC_CRT)
# cmake before version 3.15 not work
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()

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


Loading…
Cancel
Save