Skip to content

Commit 9946838

Browse files
committed
CMake Windows path normalization (#47702)
Summary: Pull Request resolved: #47702 Use `file(TO_CMAKE_PATH` to normalize paths, and normalizing `input_SRC` as it's already a CMake path. Changelog: [Internal] Reviewed By: rshest Differential Revision: D66101321 fbshipit-source-id: e81af40551d2777901f9c7cf9a4175f2bce76ec8
1 parent 08b8300 commit 9946838

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,13 @@ if(CCACHE_FOUND)
3131
endif(CCACHE_FOUND)
3232

3333
set(BUILD_DIR ${PROJECT_BUILD_DIR})
34-
if(CMAKE_HOST_WIN32)
35-
string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
36-
string(REPLACE "\\" "/" REACT_ANDROID_DIR ${REACT_ANDROID_DIR})
37-
endif()
34+
file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
35+
file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
3836

3937
file(GLOB input_SRC CONFIGURE_DEPENDS
4038
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
4139
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
4240

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

5043
target_include_directories(${CMAKE_PROJECT_NAME}

0 commit comments

Comments
 (0)