summaryrefslogtreecommitdiff
path: root/lib/spack/env/cc
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-08-06 11:26:19 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-08-08 01:51:51 -0700
commit4210f839e2e96d208a202afd0803a9bccebb4567 (patch)
treea1c614dda501f021bb0ee40d9294dd57a9aedaae /lib/spack/env/cc
parent62089d43ef5e37b7fdbb12247edc1e0bf30cc657 (diff)
downloadspack-4210f839e2e96d208a202afd0803a9bccebb4567.tar.gz
spack-4210f839e2e96d208a202afd0803a9bccebb4567.tar.bz2
spack-4210f839e2e96d208a202afd0803a9bccebb4567.tar.xz
spack-4210f839e2e96d208a202afd0803a9bccebb4567.zip
cc: restore ccache support in the wrapper, add a regression test
- Add back ccache support to the wrapper. - Add a regression test to make sure ccache is working properly.
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-xlib/spack/env/cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 5ffaf941e0..e8a0903d2a 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -481,8 +481,19 @@ for lib in "${libs[@]}"; do
args+=("-l$lib");
done
-full_command=("$command")
-full_command+=("${args[@]}")
+full_command=("$command" "${args[@]}")
+
+# prepend the ccache binary if we're using ccache
+if [ -n "$SPACK_CCACHE_BINARY" ]; then
+ case "$lang_flags" in
+ C|CXX) # ccache only supports C languages
+ full_command=("${SPACK_CCACHE_BINARY}" "${full_command[@]}")
+ # workaround for stage being a temp folder
+ # see #3761#issuecomment-294352232
+ export CCACHE_NOHASHDIR=yes
+ ;;
+ esac
+fi
# dump the full command if the caller supplies SPACK_TEST_COMMAND=dump-args
if [[ $SPACK_TEST_COMMAND == dump-args ]]; then