Make ccache work with Clang on Travis (#1097)
authorAndres Noetzli <andres.noetzli@gmail.com>
Wed, 13 Sep 2017 21:13:35 +0000 (14:13 -0700)
committerAina Niemetz <aina.niemetz@gmail.com>
Wed, 13 Sep 2017 21:13:35 +0000 (14:13 -0700)
This commit uses a workaround [0] to get ccache to work
with Clang on Travis.

[0] https://github.com/travis-ci/travis-ci/issues/5383#issuecomment-224630584

.travis.yml

index 56c1e376522e7a698df23dbc17b9a442de7e1290..e543141c01c9881d59093663a192a24b14097c71 100644 (file)
@@ -43,6 +43,16 @@ addons:
   - libreadline-dev
 before_install:
  - eval "${MATRIX_EVAL}"
+ # Clang does not play nice with ccache (at least the versions offered by
+ # Travis), use a workaround:
+ # https://github.com/travis-ci/travis-ci/issues/5383#issuecomment-224630584
+ - |
+   if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$CXX" == "clang++" ]; then
+     export CFLAGS="-Qunused-arguments"
+     export CXXFLAGS="-Qunused-arguments"
+     sudo ln -s $(which ccache) /usr/lib/ccache/clang
+     sudo ln -s $(which ccache) /usr/lib/ccache/clang++
+   fi
 before_script:
  - export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
  - export PATH=$PATH:$JAVA_HOME/bin