[CMake] How to set environment variables with spaces in commands

Qingping Hou dave2008713 at gmail.com
Wed Dec 9 23:35:11 EST 2015


Hi all,

I am trying to setup an ExternalProject in cmake but got stuck in the
configuration step. I am using ccache to speed up the compilation:

```
ExternalProject_Add(
  ...
  CONFIGURE_COMMAND CC="ccache arm-linux-gnueabihf-gcc" ./configure
  ...
)
```

However, when cmake generates the Makefile, it moves the quotes around
and breaks the command:

```
"CC=ccache arm-linux-gnueabihf-gcc" ./configure
```

I have tried various escaping method to try to get it work properly
without any luck. Is this a bug or an unintended feature?

Thanks,
QP


More information about the CMake mailing list