diff --git a/cmake/ReadMKFile.cmake b/cmake/ReadMKFile.cmake new file mode 100644 index 0000000000000000000000000000000000000000..1b2b143cd2d005a533e14e9ec96f0ba806f6d718 --- /dev/null +++ b/cmake/ReadMKFile.cmake @@ -0,0 +1,22 @@ +function(ReadVariables MKFile) + file(READ "${MKFile}" FileContents) + string(REPLACE "\\\n" "" FileContents ${FileContents}) + string(REPLACE "\n" ";" FileLines ${FileContents}) + list(REMOVE_ITEM FileLines "") + foreach(line ${FileLines}) + string(REPLACE "=" ";" line_split ${line}) + list(LENGTH line_split count) + if (count LESS 2) + message(STATUS "Skipping ${line}") + continue() + endif() + list(GET line_split -1 value) + string(STRIP ${value} value) + separate_arguments(value) + list(REMOVE_AT line_split -1) + foreach(var_name ${line_split}) + string(STRIP ${var_name} var_name) + set(${var_name} ${value} PARENT_SCOPE) + endforeach() + endforeach() +endfunction() \ No newline at end of file