Skip to content

Commit db048cf

Browse files
Lalit Bhasinlalitb
authored andcommitted
fix the cmake to not exit if the write test fail
1 parent 262a4e1 commit db048cf

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ if(UNIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
66
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation directory prefix" FORCE)
77
endif()
88

9-
# Check write access to prefix, fallback to user's home directory if needed (Unix only)
109
if(UNIX)
11-
file(WRITE "${CMAKE_INSTALL_PREFIX}/.cmake_write_test" "")
12-
if("${CMAKE_STATUS}" STREQUAL "0")
10+
# Test write access to CMAKE_INSTALL_PREFIX
11+
set(TEST_FILE "${CMAKE_INSTALL_PREFIX}/.cmake_write_test")
12+
file(WRITE "${TEST_FILE}" "") # Attempt to write the test file
13+
if(EXISTS "${TEST_FILE}")
1314
message(STATUS "Write access to ${CMAKE_INSTALL_PREFIX} confirmed.")
14-
file(REMOVE "${CMAKE_INSTALL_PREFIX}/.cmake_write_test")
15+
file(REMOVE "${TEST_FILE}") # Cleanup the test file
1516
else()
1617
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/mst_telemetry" CACHE PATH "Fallback installation directory prefix" FORCE)
1718
message(STATUS "No write access to ${CMAKE_INSTALL_PREFIX}, installing to $HOME/mst_telemetry instead.")

build-tests-ios.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
// Add current user
3+
current_user=`id`
4+
echo "CURRENT USER:" $current_user
25
cd ${0%/*}
36
SKU=${1:-release}
47
SIMULATOR=${2:-iPhone 8}

0 commit comments

Comments
 (0)