-
Notifications
You must be signed in to change notification settings - Fork 0
/
zlib.patch
38 lines (37 loc) · 1.2 KB
/
zlib.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae0f8ea..151e658 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.4.4...3.15.0)
+cmake_policy(SET CMP0091 NEW)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C)
@@ -211,3 +212,27 @@ if(HAVE_OFF64_T)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()
+
+function(get_all_targets var)
+ set(targets)
+ get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR})
+ set(${var} ${targets} PARENT_SCOPE)
+endfunction()
+
+macro(get_all_targets_recursive targets dir)
+ get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
+ foreach(subdir ${subdirectories})
+ get_all_targets_recursive(${targets} ${subdir})
+ endforeach()
+
+ get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
+ list(APPEND ${targets} ${current_targets})
+endmacro()
+
+get_all_targets(all_targets)
+
+if(MSVC)
+ foreach(target ${all_targets})
+ set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+ endforeach(target)
+endif()