Skip to content

Commit 08b8300

Browse files
FouadMagdy01blakef
authored andcommitted
fix build failure on windows in android (#47641)
Summary: This pull request addresses a CMake configuration issue where an invalid escape character in file paths caused the build process to fail. Specifically, it resolves the issue in the React Native CMake configuration file where the path separator was incorrectly handled, leading to an error in the build system. the issue is in [This Issue](expo/expo#32955) and [This](expo/expo#32957) ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL] [FIXED] - Corrected invalid escape character in CMake path handling Pull Request resolved: #47641 Test Plan: To test the changes, I performed the following steps: 1. Cloned the repository and checked out the `fix-cmake-invalid-escape-character` branch. 2. Ran the CMake build on a Windows environment where the issue was previously occurring. 3. Verified that the build process completed successfully without the "invalid character escape" error. 4. Ensured that the path handling now works correctly in CMake on Windows platforms. Reviewed By: rshest Differential Revision: D66073896 Pulled By: cipolleschi fbshipit-source-id: bd2a71bb00ce5c5509ed403842c995c32f58f91d
1 parent d01d014 commit 08b8300

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ endif(CCACHE_FOUND)
3232

3333
set(BUILD_DIR ${PROJECT_BUILD_DIR})
3434
if(CMAKE_HOST_WIN32)
35-
string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
35+
string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
36+
string(REPLACE "\\" "/" REACT_ANDROID_DIR ${REACT_ANDROID_DIR})
3637
endif()
3738

3839
file(GLOB input_SRC CONFIGURE_DEPENDS
3940
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
4041
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
4142

43+
# Ensure that `input_SRC` paths use forward slashes
44+
foreach(path IN LISTS input_SRC)
45+
string(REPLACE "\\" "/" path "${path}")
46+
endforeach()
47+
4248
add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})
4349

4450
target_include_directories(${CMAKE_PROJECT_NAME}

0 commit comments

Comments
 (0)