#20 Fix cmake-configure wrapper
Closed 3 years ago by ngompa. Opened 3 years ago by ellert.
Unknown source fix-cmake-configure  into  epel8

file modified
+2 -1
@@ -9,5 +9,6 @@

  

  # Do the build

  mkdir -p "${__cmake_builddir}"

- "${__cmake}" ${__cmake_flags} "${__cmake_srcdir}" "${__cmake_builddir}"

+ cd "${__cmake_builddir}"

+ "${__cmake}" ${__cmake_flags} "../${__cmake_srcdir}"

  exit $?

Your proposed behavior is broken too, since it changes the directory of the environment...

Pull-Request has been closed by ngompa

3 years ago

The cmake-configure script is executed, not sourced. So changing the current working directory inside the script does not change the current working directory in the calling shell.

[ellert@ellert ~]$ cat a.sh
#!/bin/bash
mkdir -p x
cd x
[ellert@ellert ~]$ pwd
/home/ellert
[ellert@ellert ~]$ ./a.sh
[ellert@ellert ~]$ pwd
/home/ellert
[ellert@ellert ~]$ . ./a.sh
[ellert@ellert x]$ pwd
/home/ellert/x

Yes, but the arguments passed to CMake would be wrong, since we don't assume you're changing directories.

And the assumption that the directory will always be a level up is flawed, unfortunately, because you can change %_vpath_builddir and %_vpath_srcdir to whatever you please.