Skip to content

Commit 916e4ba

Browse files
Add rationale to cmake-config.h.cmake.
1 parent ed2dfcf commit 916e4ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mlir/include/mlir/Config/mlir-config.h.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
/* This file enumerates variables from the MLIR configuration so that they
1010
can be in exported headers and won't override package specific directives.
11+
Defining the variables here is preferable over specifying them in CMake files
12+
via `target_compile_definitions` because it is easier to ensure that they are
13+
defined consistently across all targets: They are guaranteed to be 0/1
14+
variables thanks to #cmakedefine01, so we can test with `#if` and find
15+
missing definitions or includes with `-Wundef`. With `#ifdef`, these mistakes
16+
can go unnoticed.
17+
1118
This is a C header that can be included in the mlir-c headers. */
1219

1320
#ifndef MLIR_CONFIG_H

0 commit comments

Comments
 (0)