From 44c5cc36addeccc3ad69f31357e694cfcd09aacc Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 15 Oct 2024 04:27:04 -0700 Subject: [PATCH] Silence CMake warning caused by `PROJECT_ROOT_DIR` (#47015) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47015 CMake is complaining that this variable is set outside the build but not used. I'm using it inside our top level .cmake file to silence this warning. We need this variable as user projects might use it. Changelog: [Internal] [Changed] - Silence CMake warning caused by `PROJECT_ROOT_DIR` Reviewed By: javache Differential Revision: D64334462 fbshipit-source-id: 558bfc9f647e62890e3cc25628b5544880c47e4b --- .../ReactAndroid/cmake-utils/ReactNative-application.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake index 451a066d2391b5..f7b0fe2205f82f 100644 --- a/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake +++ b/packages/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake @@ -35,6 +35,11 @@ if(CMAKE_HOST_WIN32) string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR}) endif() +if (PROJECT_ROOT_DIR) +# This empty `if` is just to silence a CMake warning and make sure the `PROJECT_ROOT_DIR` +# variable is defined if user need to access it. +endif () + file(GLOB input_SRC CONFIGURE_DEPENDS *.cpp ${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)