mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
Respect static for zlib with CMake
This commit is contained in:
parent
759dfb28ce
commit
9d70851eb9
2 changed files with 39 additions and 2 deletions
28
build/cmake-zlib-static.patch
Normal file
28
build/cmake-zlib-static.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- CMakeLists.txt.orig 2013-04-28 17:57:10.000000000 -0500
|
||||
+++ CMakeLists.txt 2015-12-03 12:53:52.371087900 -0600
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
option(ASM686 "Enable building i686 assembly implementation")
|
||||
option(AMD64 "Enable building amd64 assembly implementation")
|
||||
+option(WITH_STATIC "Static runtime on Windows" OFF)
|
||||
|
||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||
@@ -66,6 +67,17 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
+if(WITH_STATIC AND (MSVC OR MSYS))
|
||||
+ # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace
|
||||
+ foreach(flag_var
|
||||
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
+ if(${flag_var} MATCHES "/MD")
|
||||
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
+ endif(${flag_var} MATCHES "/MD")
|
||||
+ endforeach(flag_var)
|
||||
+endif()
|
||||
+
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
# If we're doing an out of source build and the user has a zconf.h
|
||||
# in their source tree...
|
Loading…
Add table
Add a link
Reference in a new issue