[cmake-developers] ENV{SOURCE_DATE_EPOCH}

Brad King brad.king at kitware.com
Tue Nov 20 16:29:41 EST 2018


On 11/20/18 4:13 PM, Oleh Kravchenko wrote:
> I don't like idea to cover "cmake && make" with special bash script,
> just to export SOURCE_DATE_EPOCH.

SOURCE_DATE_EPOCH was created for use by packagers where tools
already wrap the build.  By making it an environment variable
packagers could jump through any number of build system layers
with no patching.

Build systems configure compilers with command-line flags, not
environment variables.  If you want to do this from within the
build system then GCC could be taught a new option for that.

You could try hacking it with `CMAKE_<LANG>_COMPILER_LAUNCHER`:

  https://cmake.org/cmake/help/v3.13/variable/CMAKE_LANG_COMPILER_LAUNCHER.html

e.g. -DCMAKE_C_COMPILER_LAUNCHER='env;SOURCE_DATE_EPOCH=1' or

```cmake
set(CMAKE_C_COMPILER_LAUNCHER env SOURCE_DATE_EPOCH=1)
```

-Brad


More information about the cmake-developers mailing list