@@ -59,6 +59,15 @@ function(vast_tablegen ofn)
59
59
)
60
60
endif ()
61
61
62
+ if (CMAKE_GENERATOR MATCHES "Visual Studio" )
63
+ # Visual Studio has problems with llvm-tblgen's native --write-if-changed
64
+ # behavior. Since it doesn't do restart optimizations anyway, just don't
65
+ # pass --write-if-changed there.
66
+ set (vast_tblgen_change_flag)
67
+ else ()
68
+ set (vast_tblgen_change_flag "--write-if-changed" )
69
+ endif ()
70
+
62
71
# We need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the DEPENDS list
63
72
# (both the target and the file) to have .inc files rebuilt on
64
73
# a tablegen change, as cmake does not propagate file-level dependencies
@@ -75,19 +84,20 @@ function(vast_tablegen ofn)
75
84
list (REMOVE_ITEM vast_tablegen_includes "" )
76
85
list (TRANSFORM vast_tablegen_includes PREPEND -I)
77
86
78
- set (tablegen_exe ${VAST_TABLEGEN_EXE} )
79
- set (tablegen_depends ${VAST_TABLEGEN_TARGET} ${tablegen_exe } )
87
+ set (vast_tablegen_exe ${VAST_TABLEGEN_EXE} )
88
+ set (vast_tablegen_depends ${VAST_TABLEGEN_TARGET} ${vast_tablegen_exe } )
80
89
81
90
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${ofn}
82
- COMMAND ${tablegen_exe } ${ARG_UNPARSED_ARGUMENTS} -I ${CMAKE_CURRENT_SOURCE_DIR}
91
+ COMMAND ${vast_tablegen_exe } ${ARG_UNPARSED_ARGUMENTS} -I ${CMAKE_CURRENT_SOURCE_DIR}
83
92
${vast_tablegen_includes}
84
93
${VAST_TABLEGEN_FLAGS}
85
94
${VAST_TARGET_DEFINITIONS_ABSOLUTE}
95
+ ${vast_tblgen_change_flag}
86
96
${additional_cmdline}
87
97
# The file in VAST_TARGET_DEFINITIONS may be not in the current
88
98
# directory and local_tds may not contain it, so we must
89
99
# explicitly list it here:
90
- DEPENDS ${ARG_DEPENDS} ${tablegen_depends }
100
+ DEPENDS ${ARG_DEPENDS} ${vast_tablegen_depends }
91
101
${local_tds} ${global_tds}
92
102
${VAST_TARGET_DEFINITIONS_ABSOLUTE}
93
103
${VAST_TARGET_DEPENDS}
0 commit comments