From d87c2fc2e33ed14ca8bb70e7753695b47cbf202d Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Wed, 9 Jul 2014 03:39:32 +0000 Subject: [PATCH] CMake: make __DATE__, __TIME__ etc. macro usage an error When LLVM_ENABLE_TIMESTAMPS has been disabled we can prevent the preprocessor from embedding dates, times and file timestamps. There are a few motivations for this: 1) Validate the recent CMake feature detection bugfix from LLVM r212586 with a flag that's not actually available everywhere. 2) Dogfood clang's new -Wdate-time warning from r210511 when bootstrapping. 3) Encourage reproducible builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212587 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/HandleLLVMOptions.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 02ff0d8200a..771ea852067 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -302,6 +302,9 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE ) endif() endif (LLVM_ENABLE_WARNINGS) append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + if (NOT LLVM_ENABLE_TIMESTAMPS) + add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME) + endif () if (LLVM_ENABLE_CXX1Y) check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y) append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS) -- 2.34.1