Skip to content

Commit

Permalink
Fix variable expansion in ReactNative-application.cmake (#35306)
Browse files Browse the repository at this point in the history
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](reactwg/react-native-releases#41 (reply in thread)) 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: #35306

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D41220408

Pulled By: rshest

fbshipit-source-id: 12ce993f0c5227ca7d3c2cc272fe3739126930b3
  • Loading branch information
kkafar authored and facebook-github-bot committed Nov 12, 2022
1 parent 99381de commit 4c1d5ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ReactAndroid/cmake-utils/ReactNative-application.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 4c1d5ad

Please sign in to comment.