Skip to content

Commit 28531d1

Browse files
committed
Simplify bootstrap script source dir detection
This teaches the bootstrap shell script to detect the CMake source directory from which it is executed using a simpler idiom.
1 parent d468145 commit 28531d1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

bootstrap

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ cmake_date_stamp_component()
3434

3535
# Detect system and directory information.
3636
cmake_system=`uname`
37-
cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
38-
cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
37+
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
3938
cmake_binary_dir=`pwd`
4039
cmake_version_major="`cmake_version_component MAJOR`"
4140
cmake_version_minor="`cmake_version_component MINOR`"

configure

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#! /bin/sh
2-
cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
1+
#!/bin/sh
2+
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
33
exec "${cmake_source_dir}/bootstrap" "$@"

0 commit comments

Comments
 (0)