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
This commit is contained in:
Kacper Kafara 2022-11-12 09:11:46 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 99381de753
Коммит 4c1d5ad9c6
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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()