Debian Codegraph @

storage/mroonga/vendor/groonga/build/cmake_modules/ReadFileList.cmake

raw
1 # Copyright(C) 2012 Brazil
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License version 2.1 as published by the Free Software Foundation.
6 #
7 # This library is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 # Lesser General Public License for more details.
11 #
12 # You should have received a copy of the GNU Lesser General Public
13 # License along with this library; if not, write to the Free Software
14 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
15
16 macro(read_file_list file_name output_variable)
17 file(READ ${file_name} ${output_variable})
18 # Remove variable declaration at the first line:
19 # "libgroonga_la_SOURCES = \" -> ""
20 string(REGEX REPLACE "^.*=[ \t]*\\\\" ""
21 ${output_variable} "${${output_variable}}")
22 # Remove white spaces: " com.c \\\n com.h \\\n" -> "com.c\\com.h"
23 string(REGEX REPLACE "[ \t\n]" "" ${output_variable} "${${output_variable}}")
24 # Convert string to list: "com.c\\com.h" -> "com.c;com.h"
25 # NOTE: List in CMake is ";" separated string.
26 string(REGEX REPLACE "\\\\" ";" ${output_variable} "${${output_variable}}")
27 endmacro()