@@ -247,115 +247,7 @@ function(linker_only OUTPUT_VAR TOKEN)
247247 endif ()
248248endfunction ()
249249
250- ####
251- # build_relative_path:
252- #
253- # Calculate the path to an item relative to known build paths. Search is performed in the following order erring if the
254- # item is found in multiple paths.
255- #
256- # INPUT_PATH: input path to search
257- # OUTPUT_VAR: output variable to fill
258- ####
259- function (build_relative_path INPUT_PATH OUTPUT_VAR )
260- # Implementation assertion
261- if (NOT DEFINED FPRIME_BUILD_LOCATIONS)
262- message (FATAL_ERROR "FPRIME_BUILD_LOCATIONS not set before build_relative_path was called" )
263- endif ()
264- normalize_paths (FPRIME_LOCS_NORM ${FPRIME_BUILD_LOCATIONS} )
265- normalize_paths (INPUT_PATH ${INPUT_PATH} )
266- foreach (PARENT IN LISTS FPRIME_LOCS_NORM)
267- string (REGEX REPLACE "${PARENT} /(.*)$" "\\ 1" LOC_TEMP "${INPUT_PATH} " )
268- if (NOT LOC_TEMP STREQUAL INPUT_PATH AND NOT LOC_TEMP MATCHES "${LOC} $" )
269- message (FATAL_ERROR "Found ${INPUT_PATH} at multiple locations: ${LOC} and ${LOC_TEMP} " )
270- elseif (NOT LOC_TEMP STREQUAL INPUT_PATH AND NOT DEFINED LOC)
271- set (LOC "${LOC_TEMP} " )
272- endif ()
273- endforeach ()
274- if (LOC STREQUAL "" )
275- message (FATAL_ERROR "Failed to find location for: ${INPUT_PATH} " )
276- endif ()
277- set (${OUTPUT_VAR} ${LOC} PARENT_SCOPE )
278- endfunction (build_relative_path )
279-
280- ####
281- # on_any_changed:
282- #
283- # Sets VARIABLE to true if any file has been noted as changed from the "on_changed" function. Will create cache files
284- # in the binary directory. Please see: on_changed
285- #
286- # INPUT_FILES: files to check for changes
287- # ARGN: passed into execute_process via on_changed call
288- ####
289- function (on_any_changed INPUT_FILES VARIABLE )
290- foreach (INPUT_FILE IN LISTS INPUT_FILES)
291- on_changed ("${INPUT_FILE} " TEMP_ON_CHANGED ${ARGN} )
292- if (TEMP_ON_CHANGED)
293- set (${VARIABLE} TRUE PARENT_SCOPE )
294- return ()
295- endif ()
296- endforeach ()
297- set (${VARIABLE} FALSE PARENT_SCOPE )
298- endfunction ()
299-
300- ####
301- # on_changed:
302- #
303- # Sets VARIABLE to true if and only if the given file has changed since the last time this function was invoked. It will
304- # create "${INPUT_FILE}.prev" in the binary directory as a cache from the previous invocation. The result is always TRUE
305- # unless a successful no-difference is calculated.
306- #
307- # INPUT_FILE: file to check if it has changed
308- # ARGN: passed into execute_process
309- ####
310- function (on_changed INPUT_FILE VARIABLE )
311- get_filename_component (INPUT_BASENAME "${INPUT_FILE} " NAME )
312- set (PREVIOUS_FILE "${CMAKE_CURRENT_BINARY_DIR } /${INPUT_BASENAME} .prev" )
313-
314- execute_process (COMMAND "${CMAKE_COMMAND } " -E compare_files "${INPUT_FILE} " "${PREVIOUS_FILE} "
315- RESULT_VARIABLE difference OUTPUT_QUIET ERROR_QUIET )
316- # Files are the same, leave this function
317- if (difference EQUAL 0)
318- set (${VARIABLE} FALSE PARENT_SCOPE )
319- return ()
320- endif ()
321- set (${VARIABLE} TRUE PARENT_SCOPE )
322- # Update the file with the latest
323- if (EXISTS "${INPUT_FILE} " )
324- execute_process (COMMAND "${CMAKE_COMMAND } " -E copy "${INPUT_FILE} " "${PREVIOUS_FILE} " OUTPUT_QUIET )
325- endif ()
326- endfunction ()
327250
328- ####
329- # read_from_lines:
330- #
331- # Reads a set of variables from a newline delimited test base. This will read each variable as a separate line. It is
332- # based on the number of arguments passed in.
333- ####
334- function (read_from_lines CONTENT )
335- # Loop through each arg
336- foreach (NAME IN LISTS ARGN)
337- string (REGEX MATCH "^([^\r\n ]+)" VALUE "${CONTENT} " )
338- string (REGEX REPLACE "^([^\r\n ]*)\r ?\n (.*)" "\\ 2" CONTENT "${CONTENT} " )
339- set (${NAME} "${VALUE} " PARENT_SCOPE )
340- endforeach ()
341- endfunction ()
342-
343- ####
344- # Function `full_path_from_build_relative_path`:
345- #
346- # Creates a full path from the shortened build-relative path.
347- # -**SHORT_PATH:** build relative path
348- # Return: full path from relative path
349- ####
350- function (full_path_from_build_relative_path SHORT_PATH OUTPUT_VARIABLE )
351- foreach (FPRIME_LOCATION IN LISTS FPRIME_BUILD_LOCATIONS)
352- if (EXISTS "${FPRIME_LOCATION} /${SHORT_PATH} " )
353- set ("${OUTPUT_VARIABLE} " "${FPRIME_LOCATION} /${SHORT_PATH} " PARENT_SCOPE )
354- return ()
355- endif ()
356- endforeach ()
357- set ("${OUTPUT_VARIABLE} " "" PARENT_SCOPE )
358- endfunction (full_path_from_build_relative_path )
359251
360252####
361253# Function `get_nearest_build_root`:
@@ -575,25 +467,7 @@ function(append_list_property NEW_ITEM)
575467 set_property (${ARGN} "${LOCAL_COPY} " )
576468endfunction ()
577469
578- ####
579- # Function `filter_lists`:
580- #
581- # Filters lists set in ARGN to to ensure that they are not in the exclude list. Sets the <LIST>_FILTERED variable in
582- # PARENT_SCOPE with the results
583- # **EXCLUDE_LIST**: list of items to filter-out of ARGN lists
584- # **ARGN:** list of list names in parent scope to filter
585- ####
586- function (filter_lists EXCLUDE_LIST )
587- foreach (SOURCE_LIST IN LISTS ARGN)
588- set (${SOURCE_LIST} _FILTERED "" )
589- foreach (SOURCE IN LISTS ${SOURCE_LIST} )
590- if (NOT SOURCE IN_LIST EXCLUDE_LIST)
591- list (APPEND ${SOURCE_LIST} _FILTERED "${SOURCE} " )
592- endif ()
593- endforeach ()
594- set (${SOURCE_LIST} _FILTERED "${${SOURCE_LIST} _FILTERED}" PARENT_SCOPE )
595- endforeach ()
596- endfunction (filter_lists )
470+
597471
598472####
599473# Function `get_fprime_library_option_string`:
0 commit comments