Skip to content

Commit 65be40d

Browse files
Support prebuild on win/mac (#1191)
Co-authored-by: Michael Graeb <[email protected]>
1 parent 568f46b commit 65be40d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cmake/AwsPrebuildDependency.cmake

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ endfunction()
9696
function(aws_get_variables_for_prebuild_dependency AWS_CMAKE_PREBUILD_ARGS)
9797
set(variables "")
9898

99-
# The CMake variables below were chosen for Linux, BSD, and Android platforms. If you want to use the prebuild logic
100-
# on other platforms, the chances are you have to handle additional variables (like CMAKE_OSX_SYSROOT). Refer to
101-
# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html to update the list of handled variables, and
102-
# then you can enable a new platform here.
103-
if ((NOT UNIX) OR APPLE)
104-
message(FATAL_ERROR "aws_get_variables_for_prebuild_dependency is called for unsupported platform")
105-
endif()
99+
100+
# The variables below were chosen based on reading docs and a lot of experimenting on different platforms.
101+
# Is the list of variables below exhaustive and guaranteed to cover all cases? Probably not.
102+
# So if you are here reading this, then its more than likely that some variable got missed and something
103+
# is not building correctly. So don't be afraid to add more variables to the list.
104+
# Refer to https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html as a decent starting point for which variables to handle.
106105

107106
get_cmake_property(vars CACHE_VARIABLES)
108107
foreach(var ${vars})
@@ -137,7 +136,12 @@ function(aws_get_variables_for_prebuild_dependency AWS_CMAKE_PREBUILD_ARGS)
137136
OR var STREQUAL "CMAKE_MAKE_PROGRAM"
138137
OR var MATCHES "^CMAKE_RUNTIME_OUTPUT_DIRECTORY"
139138
OR var MATCHES "^CMAKE_ARCHIVE_OUTPUT_DIRECTORY"
140-
OR var MATCHES "^CMAKE_LIBRARY_OUTPUT_DIRECTORY")
139+
OR var MATCHES "^CMAKE_LIBRARY_OUTPUT_DIRECTORY"
140+
OR var STREQUAL "CMAKE_OSX_ARCHITECTURES"
141+
OR var STREQUAL "CMAKE_OSX_DEPLOYMENT_TARGET"
142+
OR var STREQUAL "CMAKE_OSX_SYSROOT"
143+
OR var MATCHES "^CMAKE_GENERATOR"
144+
)
141145
# To store a list within another list, it needs to be escaped first.
142146
string(REPLACE ";" "\\\\;" escapedVar "${${var}}")
143147
if (escapedVar)

0 commit comments

Comments
 (0)