Fix cmake's multi-config generators after r326738

LLVM_ENABLE_STATS isn't known at configure-time in these generators so we must
defer it to build-time.

llvm-svn: 326936
This commit is contained in:
Daniel Sanders 2018-03-07 19:32:36 +00:00
parent 65e64917e3
commit 6cf299cf01
3 changed files with 9 additions and 4 deletions

View File

@ -882,6 +882,4 @@ function(get_compile_definitions)
endfunction()
get_compile_definitions()
# The default for LLVM_ENABLE_STATS depends on whether NDEBUG is defined or not.
# LLVM_ENABLE_ASSERTIONS controls that so re-use it as the default.
option(LLVM_ENABLE_STATS "Enable statistics collection" ${LLVM_ENABLE_ASSERTIONS})
option(LLVM_FORCE_ENABLE_STATS "Enable statistics collection for builds that wouldn't normally enable it" OFF)

View File

@ -32,6 +32,13 @@
#include <memory>
#include <vector>
// Determine whether statistics should be enabled. We must do it here rather
// than in CMake because multi-config generators cannot determine this at
// configure time.
#if !defined(NDEBUG) || LLVM_FORCE_ENABLE_STATS
#define LLVM_ENABLE_STATS 1
#endif
namespace llvm {
class raw_ostream;

View File

@ -80,6 +80,6 @@
/* Whether LLVM records statistics for use with GetStatistics(),
* PrintStatistics() or PrintStatisticsJSON()
*/
#cmakedefine01 LLVM_ENABLE_STATS
#cmakedefine01 LLVM_FORCE_ENABLE_STATS
#endif