]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cmake: pass LDSHARED env var to distutils
authorKefu Chai <kchai@redhat.com>
Sat, 11 Nov 2017 17:50:42 +0000 (01:50 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 15 Nov 2017 07:22:07 +0000 (15:22 +0800)
commit571a786afcaba6e07f6a70313ce78a2dd66b712a
tree5eae3dcf6fad7174a0f2b579ca0f1d577893a105
parente8df19197e00ff21a5389d34665aaaf1c7d94534
cmake: pass LDSHARED env var to distutils

otherwise, the default gcc will be used, and the $CMAKE_C_COMPILER
passed to the outer CMakeLists.txt won't kick in. moreover, if the
building script (ceph.spec for instance) could set the $PATH, and
expect that the CMakeLists.txt will use the toolchain executables
in the $PATH to build Ceph, distutils will continue using the default
$CC for linking the python bindings, on UNIX it will be gcc in the
new shell's $PATH, because we are using `install(CODE "... execute_process(
...))` for installing the python bindings. apparently, this is not
expected. because the new shell's $PATH is very likely different
from the one changed by the building script. to address this, we
should always specify the `$LDSHARED` env var explicitly.

also, pass env vars using `ENV{}` instead of the `env` command to
workaround the issue of https://cmake.org/pipermail/cmake/2015-December/062216.html,
because it's not straightforward to set environment variables with
spaces in the them using cmake. and because one cannot use add_custom_target()
in the script mode of cmake. this leave me only limited options to
fix this issue.

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Distutils.cmake