@@ -104,15 +104,15 @@ function(dynamic_version)
104
104
TMP_FOLDER ${ARGS_TMP_FOLDER}
105
105
)
106
106
if (DEFINED ARGS_FALLBACK_VERSION)
107
- list (DynamicVersion_ARGS APPEND
107
+ list (APPEND DynamicVersion_ARGS
108
108
FALLBACK_VERSION ${ARGS_FALLBACK_VERSION} )
109
109
endif ()
110
110
if (DEFINED ARGS_FALLBACK_HASH)
111
- list (DynamicVersion_ARGS APPEND
111
+ list (APPEND DynamicVersion_ARGS
112
112
FALLBACK_HASH ${ARGS_FALLBACK_HASH} )
113
113
endif ()
114
114
if (ARGS_ALLOW_FAILS)
115
- list (DynamicVersion_ARGS APPEND ALLOW_FAILS)
115
+ list (APPEND DynamicVersion_ARGS ALLOW_FAILS)
116
116
endif ()
117
117
# Normalize DynamicVersion_ARGS to be passed as string
118
118
list (JOIN DynamicVersion_ARGS "\\ ;" DynamicVersion_ARGS)
@@ -127,7 +127,9 @@ function(dynamic_version)
127
127
128
128
# Copy all configured files
129
129
foreach (file IN ITEMS .DynamicVersion.json .version .git_describe .git_commit)
130
- file (COPY_FILE ${ARGS_TMP_FOLDER} /${file} ${ARGS_OUTPUT_FOLDER} /${file} )
130
+ if (EXISTS ${file} )
131
+ file (COPY_FILE ${ARGS_TMP_FOLDER} /${file} ${ARGS_OUTPUT_FOLDER} /${file} )
132
+ endif ()
131
133
endforeach ()
132
134
133
135
# Check configuration state
@@ -246,13 +248,21 @@ function(get_dynamic_version)
246
248
endif ()
247
249
248
250
251
+ if (NOT EXISTS ${ARGS_GIT_ARCHIVAL_FILE} )
252
+ # If git_archival.txt is missing, project is ill-formed
253
+ message (${error_message_type}
254
+ "DynamicVersion: Missing file .git_archival.txt\n "
255
+ " .git_archival.txt: ${ARGS_GIT_ARCHIVAL_FILE} " )
256
+ return ()
257
+ endif ()
258
+
249
259
# Get version dynamically from git_archival.txt
250
260
file (STRINGS ${ARGS_GIT_ARCHIVAL_FILE} describe-name
251
261
REGEX "^describe-name:.*" )
252
262
if (NOT describe-name )
253
263
# If git_archival.txt does not contain the field "describe-name:", it is ill-formed
254
264
message (${error_message_type}
255
- "DynamicVersion: Missing file or string \" describe-name\" in .git_archival.txt\n "
265
+ "DynamicVersion: Missing string \" describe-name\" in .git_archival.txt\n "
256
266
" .git_archival.txt: ${ARGS_GIT_ARCHIVAL_FILE} " )
257
267
return ()
258
268
endif ()
0 commit comments