]> git.tdb.fi Git - builder.git/blobdiff - source/csourcefile.cpp
Add target and tools for compiling Objective-C sources
[builder.git] / source / csourcefile.cpp
index 13c74b9dcef247402490da7d7638de379c50f067..e34ff279cc4c98d199b491c075e17bc4c689a449 100644 (file)
@@ -22,6 +22,16 @@ CSourceFile::CSourceFile(Builder &b, const Component &c, const FS::Path &p):
                install_location = FS::Path("include")/package->get_name();
 }
 
+void CSourceFile::parse_includes(IO::Base &in)
+{
+       static Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]");
+
+       string line;
+       while(in.getline(line))
+               if(RegMatch match = r_include.match(line))
+                       includes.push_back(match[1].str);
+}
+
 void CSourceFile::find_dependencies()
 {
        if(!component || !mtime)
@@ -38,13 +48,7 @@ void CSourceFile::find_dependencies()
 
                builder.get_logger().log("files", format("Reading includes from %s", path.str()));
 
-               Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]");
-
-               string line;
-               while(in.getline(line))
-                       if(RegMatch match = r_include.match(line))
-                               includes.push_back(match[1].str);
-
+               parse_includes(in);
                cache.set_values(this, "includes", includes);
        }