@@ -46,21 +46,33 @@ set_option_from_env(ZMQ_NO_SYNC_RESOLVE)
46
46
if (APPLE )
47
47
option (MACOSX_DEPLOYMENT_TARGET "MacOS deployment target" "10.15" )
48
48
set_option_from_env (MACOSX_DEPLOYMENT_TARGET )
49
+ set (CMAKE_OSX_DEPLOYMENT_TARGET
50
+ ${MACOSX_DEPLOYMENT_TARGET}
51
+ CACHE STRING "MacOS deployment target" )
49
52
endif ()
50
53
51
- # MacOS deployment target
54
+ # Set the target system on Windows (for cross-compiling x86)
52
55
if (WIN32 )
53
56
if ("${PLATFORM} " STREQUAL "x86" )
54
57
set (CMAKE_SYSTEM_PROCESSOR "x86" )
55
58
set (CMAKE_SYSTEM_HOST_PROCESSOR "x86" )
59
+ # static linking for vcpkg
60
+ set (VCPKG_TARGET_TRIPLET "x86-windows-static" )
56
61
elseif (NOT "$ENV{PROCESSOR_ARCHITEW6432} " STREQUAL "" )
57
62
set (CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432} " )
58
63
set (CMAKE_SYSTEM_HOST_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432} " )
64
+ # static linking for vcpkg
65
+ set (VCPKG_TARGET_TRIPLET "x86-windows-static" )
59
66
else ()
60
67
set (CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE} " )
61
68
set (CMAKE_SYSTEM_HOST_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE} " )
69
+ # static linking for vcpkg
70
+ set (VCPKG_TARGET_TRIPLET "x64-windows-static" )
62
71
endif ()
72
+ # Avoid loading of project_optinos/WindowsToolchain
63
73
set (CMAKE_TOOLCHAIN_FILE ";" )
74
+ # use static runtime library
75
+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" )
64
76
endif ()
65
77
66
78
include (FetchContent )
@@ -82,13 +94,9 @@ FetchContent_MakeAvailable(_project_options)
82
94
include (${_project_options_SOURCE_DIR} /Index.cmake )
83
95
84
96
# MacOS flags that should be set prior to any project calls
85
- if (DEFINED APPLE AND APPLE )
97
+ if (APPLE )
86
98
set (CMAKE_SHARED_LINKER_FLAGS
87
99
"${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup" )
88
- set (CMAKE_OSX_DEPLOYMENT_TARGET
89
- "10.15"
90
- CACHE STRING "Minimum OS X deployment version" )
91
- add_definitions (-DMAC_OS_X_VERSION_MIN_REQUIRED=101500 )
92
100
endif ()
93
101
94
102
run_vcpkg (VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV
@@ -133,7 +141,7 @@ endif()
133
141
# Use `.node` for the library without any "lib" prefix
134
142
set_target_properties (addon PROPERTIES PREFIX "" SUFFIX ".node" )
135
143
136
- # Windows workaround
144
+ # Windows
137
145
if (WIN32 )
138
146
set_property (TARGET addon PROPERTY LINK_FLAGS "-Xlinker /DELAYLOAD:NODE.EXE" )
139
147
target_link_libraries (addon PRIVATE "ShLwApi.lib" "delayimp.lib" )
0 commit comments