Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ endif()
# Some of the external libraries are not used for mobile.
if(DESKTOP)
# Build curl as a static library
set(CURL_STATICLIB ON CACHE BOOL "")
set(BUILD_SHARED_LIBS OFF)
set(BUILD_CURL_EXE OFF)
set(CURL_STATICLIB ON)
Comment on lines +429 to +431

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Setting BUILD_SHARED_LIBS globally to OFF will leak to all subsequent subdirectories and external libraries (such as libuv, zlib, and the Firebase SDK components themselves like app, analytics, etc.). This overrides any user-specified BUILD_SHARED_LIBS setting for the rest of the build.\n\nTo prevent this side effect, you should save the original value of BUILD_SHARED_LIBS before modifying it, and restore it immediately after add_external_library(curl) (around line 450).\n\nSince add_external_library(curl) is outside of this diff hunk, please apply the following pattern:\n\n1. Save the variable state here (using the code suggestion below).\n2. Restore it after add_external_library(curl):\ncmake\nif(DEFINED OLD_BUILD_SHARED_LIBS)\n set(BUILD_SHARED_LIBS ${OLD_BUILD_SHARED_LIBS})\nelse()\n unset(BUILD_SHARED_LIBS)\nendif()\n

  set(OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})\n  set(BUILD_SHARED_LIBS OFF)\n  set(BUILD_CURL_EXE OFF)\n  set(CURL_STATICLIB ON)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firebase C++ expects the dependencies to be static, so this should have no issue.

if (WIN32)
# Enable Windows native SSL/TLS in libcurl.
set(CMAKE_USE_SCHANNEL ON CACHE BOOL "")
set(CMAKE_USE_SCHANNEL ON)
endif()

# Current Curl library defaults to requiring some dependencies we don't need, disable them.
Expand Down
Loading