From 99bcbad2b2485f749e30be37bb3e822de1a3710a Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Sat, 12 Nov 2022 09:11:46 -0800 Subject: [PATCH] Fix variable expansion in ReactNative-application.cmake (#35306) Summary: Hi, while adjusting [react-native-screens](https://github.com/software-mansion/react-native-screens) to `0.71.0-rc.0` I encountered the same problems as reported [here](https://github.com/reactwg/react-native-releases/discussions/41#discussioncomment-4085694) by WoLewicki. Basically inside `CMake`'s `foreach` loop iterator variable is not being expanded to the actual value: ```cmake foreach(autolinked_library ${AUTOLINKED_LIBRARIES}) target_link_libraries(autolinked_library common_flags) // <-- here we are literally linking to "autolinked_library". endforeach() ``` ## Changelog [Android] [Fixed] - Fix Android autolinking failing because of not expanded variable Pull Request resolved: https://github.com/facebook/react-native/pull/35306 Reviewed By: christophpurrer, cipolleschi Differential Revision: D41220408 Pulled By: rshest fbshipit-source-id: 12ce993f0c5227ca7d3c2cc272fe3739126930b3 --- ReactAndroid/cmake-utils/ReactNative-application.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/cmake-utils/ReactNative-application.cmake b/ReactAndroid/cmake-utils/ReactNative-application.cmake index 2b2a79d8694a4a..fe3a8ca6f79a79 100644 --- a/ReactAndroid/cmake-utils/ReactNative-application.cmake +++ b/ReactAndroid/cmake-utils/ReactNative-application.cmake @@ -106,7 +106,7 @@ if(EXISTS ${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/Android-rncli.cmake) include(${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/Android-rncli.cmake) target_link_libraries(${CMAKE_PROJECT_NAME} ${AUTOLINKED_LIBRARIES}) foreach(autolinked_library ${AUTOLINKED_LIBRARIES}) - target_link_libraries(autolinked_library common_flags) + target_link_libraries(${autolinked_library} common_flags) endforeach() endif()