Skip to content

Commit 9171093

Browse files
Fix: Link Crypt32.lib for firebase_analytics on Windows
Add Crypt32.lib to the linked libraries for the firebase_analytics target on Windows. This resolves a linker error LNK2019 for _CryptBinaryToStringA@20, which was occurring in builds that included analytics_windows.obj (e.g., firebase_analytics_test). While CryptBinaryToStringA is not directly called in analytics_windows.cc, the linker indicates that analytics_windows.obj requires this symbol, possibly due to an indirect dependency or other build system interactions. Linking Crypt32.lib provides the necessary symbol.
1 parent c6cf8f6 commit 9171093

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

analytics/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ set_property(TARGET firebase_analytics PROPERTY FOLDER "Firebase Cpp")
104104
# Set up the dependency on Firebase App.
105105
target_link_libraries(firebase_analytics
106106
PUBLIC firebase_app)
107+
if(WIN32)
108+
target_link_libraries(firebase_analytics PUBLIC Crypt32.lib)
109+
endif()
107110
# Public headers all refer to each other relative to the src/include directory,
108111
# while private headers are relative to the entire C++ SDK directory.
109112
target_include_directories(firebase_analytics

0 commit comments

Comments
 (0)