@@ -94,53 +94,65 @@ add_custom_command(
94
94
)
95
95
set_source_files_properties (${GENERATED_SRC} /resources.cpp PROPERTIES GENERATED 1 )
96
96
97
- set (LEX_FILES scanner
97
+ set (LEX_FILES
98
98
code
99
- pyscanner
100
- pycode
101
- fortranscanner
102
- fortrancode
103
- vhdlcode
104
- pre
105
- declinfo
106
- defargs
107
- doctokenizer
108
99
commentcnv
109
100
commentscan
101
+ configimpl
110
102
constexp
111
- xmlcode
112
- sqlcode
103
+ declinfo
104
+ defargs
105
+ doctokenizer
106
+ fortrancode
107
+ fortranscanner
113
108
lexcode
114
109
lexscanner
115
- configimpl )
110
+ pre
111
+ pycode
112
+ pyscanner
113
+ scanner
114
+ sqlcode
115
+ vhdlcode
116
+ xmlcode
117
+ )
116
118
117
119
if (NOT depfile_supported )
118
120
# In case the DEPFILE possibility is not supported the complete list of lex include files for the dependency has to be used
119
121
set (LEX_INC_FILES )
120
122
endif ()
121
123
122
- # unfortunately ${LEX_FILES_H} and ${LEX_FILES_CPP} don't work in older versions of CMake (like 3.6.2) for add_library
124
+ set (LEX_FILES_H )
125
+ set (LEX_FILES_CPP )
126
+ set (_depfile_args )
127
+
123
128
foreach (lex_file ${LEX_FILES} )
124
- set (LEX_FILES_H ${LEX_FILES_H} " " ${GENERATED_SRC} /${lex_file}.l.h CACHE INTERNAL "Stores generated files" )
125
- set (LEX_FILES_CPP ${LEX_FILES_CPP} " " ${GENERATED_SRC} /${lex_file}.cpp CACHE INTERNAL "Stores generated files" )
129
+ # configimpl is handled specially (it's in the static lib)
130
+ if (NOT lex_file STREQUAL "configimpl" )
131
+ list (APPEND LEX_FILES_H ${GENERATED_SRC} /${lex_file}.l.h )
132
+ list (APPEND LEX_FILES_CPP ${GENERATED_SRC} /${lex_file}.cpp )
133
+ endif ()
134
+
135
+ set (_generated_files
136
+ ${GENERATED_SRC} /${lex_file}.l
137
+ ${GENERATED_SRC} /${lex_file}.corr
138
+ ${GENERATED_SRC} /${lex_file}.d )
126
139
127
140
if (depfile_supported )
128
- add_custom_command (
129
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.corr ${GENERATED_SRC} /${lex_file}.d ${CMAKE_CURRENT_LIST_DIR}
130
- DEPENDS ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l
131
- DEPFILE ${GENERATED_SRC} /${lex_file}.d
132
- OUTPUT ${GENERATED_SRC} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.corr ${GENERATED_SRC} /${lex_file}.d
133
- )
134
- else ()
135
- add_custom_command (
136
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.corr ${GENERATED_SRC} /${lex_file}.d ${CMAKE_CURRENT_LIST_DIR}
137
- DEPENDS ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l ${LEX_INC_FILES}
138
- OUTPUT ${GENERATED_SRC} /${lex_file}.l ${GENERATED_SRC} /${lex_file}.corr ${GENERATED_SRC} /${lex_file}.d
139
- )
141
+ set (_depfile_args DEPFILE ${GENERATED_SRC} /${lex_file}.d )
140
142
endif ()
141
- set_source_files_properties (${GENERATED_SRC} /${lex_file}.l PROPERTIES GENERATED 1 )
142
- set_source_files_properties (${GENERATED_SRC} /${lex_file}.corr PROPERTIES GENERATED 1 )
143
- set_source_files_properties (${GENERATED_SRC} /${lex_file}.d PROPERTIES GENERATED 1 )
143
+ add_custom_command (
144
+ OUTPUT ${_generated_files}
145
+ COMMAND ${PYTHON_EXECUTABLE}
146
+ ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py
147
+ ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l
148
+ ${_generated_files}
149
+ ${CMAKE_CURRENT_LIST_DIR}
150
+ DEPENDS
151
+ ${CMAKE_CURRENT_LIST_DIR} /pre_lex.py
152
+ ${CMAKE_CURRENT_LIST_DIR} /${lex_file}.l
153
+ ${_depfile_args}
154
+ )
155
+ set_source_files_properties (${_generated_files} PROPERTIES GENERATED 1 )
144
156
145
157
add_custom_command (
146
158
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR} /scan_states.py ${GENERATED_SRC} /${lex_file}.l > ${GENERATED_SRC} /${lex_file}.l.h
@@ -168,6 +180,12 @@ foreach(lex_file ${LEX_FILES})
168
180
OUTPUT ${GENERATED_SRC} /${lex_file}.cpp
169
181
)
170
182
endforeach ()
183
+ unset (_depfile_args )
184
+ unset (_generated_files )
185
+
186
+ # Cache generated sources lists
187
+ set (LEX_FILES_H ${LEX_FILES_H} CACHE INTERNAL "Stores generated files" )
188
+ set (LEX_FILES_CPP ${LEX_FILES_CPP} CACHE INTERNAL "Stores generated files" )
171
189
172
190
173
191
BISON_TARGET (constexp
@@ -200,44 +218,8 @@ add_sanitizers(doxycfg)
200
218
201
219
add_library (doxymain STATIC
202
220
# generated for/by flex/bison
203
- #${LEX_FILES_H} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
204
- #${LEX_FILES_CPP} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
205
- ${GENERATED_SRC} /code.l.h
206
- ${GENERATED_SRC} /commentcnv.l.h
207
- ${GENERATED_SRC} /commentscan.l.h
208
- ${GENERATED_SRC} /constexp.cpp
209
- ${GENERATED_SRC} /constexp.l.h
210
- ${GENERATED_SRC} /declinfo.l.h
211
- ${GENERATED_SRC} /defargs.l.h
212
- ${GENERATED_SRC} /doctokenizer.l.h
213
- ${GENERATED_SRC} /fortrancode.l.h
214
- ${GENERATED_SRC} /fortranscanner.l.h
215
- ${GENERATED_SRC} /lexcode.l.h
216
- ${GENERATED_SRC} /lexscanner.l.h
217
- ${GENERATED_SRC} /pre.l.h
218
- ${GENERATED_SRC} /pycode.l.h
219
- ${GENERATED_SRC} /pyscanner.l.h
220
- ${GENERATED_SRC} /scanner.l.h
221
- ${GENERATED_SRC} /sqlcode.l.h
222
- ${GENERATED_SRC} /vhdlcode.l.h
223
- ${GENERATED_SRC} /xmlcode.l.h
224
- ${GENERATED_SRC} /code.cpp
225
- ${GENERATED_SRC} /commentcnv.cpp
226
- ${GENERATED_SRC} /commentscan.cpp
227
- ${GENERATED_SRC} /declinfo.cpp
228
- ${GENERATED_SRC} /defargs.cpp
229
- ${GENERATED_SRC} /doctokenizer.cpp
230
- ${GENERATED_SRC} /fortrancode.cpp
231
- ${GENERATED_SRC} /fortranscanner.cpp
232
- ${GENERATED_SRC} /lexcode.cpp
233
- ${GENERATED_SRC} /lexscanner.cpp
234
- ${GENERATED_SRC} /pre.cpp
235
- ${GENERATED_SRC} /pycode.cpp
236
- ${GENERATED_SRC} /pyscanner.cpp
237
- ${GENERATED_SRC} /scanner.cpp
238
- ${GENERATED_SRC} /sqlcode.cpp
239
- ${GENERATED_SRC} /vhdlcode.cpp
240
- ${GENERATED_SRC} /xmlcode.cpp
221
+ ${LEX_FILES_H}
222
+ ${LEX_FILES_CPP}
241
223
#
242
224
${GENERATED_SRC} /ce_parse.cpp
243
225
# custom generated files
@@ -422,4 +404,3 @@ set_project_coverage(doxymain)
422
404
set_project_coverage (doxygen )
423
405
424
406
install (TARGETS doxygen DESTINATION bin )
425
-
0 commit comments