]> git.tdb.fi Git - builder.git/blobdiff - source/builder.cpp
Bump version to 1.0
[builder.git] / source / builder.cpp
index 5fb918c512a8e3ce7fc95b023a2dcc2a43a55108..ce82ba33351f191f1055eae0a053c915247a2053 100644 (file)
@@ -384,16 +384,21 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
                StringList argv;
                argv.push_back(current_arch->get_tool("CXX"));
                argv.push_back("--version");
-               cxx_ver=Regex("[0-9]\\.[0-9.]+").match(run_command(argv))[0].str;
-               while(!cxx_ver.empty() && !FS::is_dir(FS::Path("/usr/include/c++")/cxx_ver))
+               if(RegMatch m=Regex("[0-9]\\.[0-9.]+").match(run_command(argv)))
                {
-                       string::size_type dot=cxx_ver.rfind('.');
-                       if(dot==string::npos)
-                               break;
-                       cxx_ver.erase(dot);
+                       cxx_ver=m[0].str;
+                       while(!cxx_ver.empty() && !FS::is_dir(FS::Path("/usr/include/c++")/cxx_ver))
+                       {
+                               string::size_type dot=cxx_ver.rfind('.');
+                               if(dot==string::npos)
+                                       break;
+                               cxx_ver.erase(dot);
+                       }
+                       if(verbose>=5)
+                               IO::print("C++ version is %s\n", cxx_ver);
                }
-               if(verbose>=5)
-                       IO::print("C++ version is %s\n", cxx_ver);
+               else
+                       cxx_ver="-";
        }
 
        string fn=include.substr(1);
@@ -405,7 +410,8 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
                syspath.push_back("/usr/include");
        else
                syspath.push_back("/usr/"+current_arch->get_prefix()+"/include");
-       syspath.push_back((FS::Path("/usr/include/c++/")/cxx_ver).str());
+       if(cxx_ver!="-")
+               syspath.push_back((FS::Path("/usr/include/c++/")/cxx_ver).str());
 
        Target *tgt=0;
        if(include[0]=='\"')
@@ -497,6 +503,7 @@ void Builder::usage(const char *reason, const char *argv0, bool brief)
                IO::print(IO::cerr, "Usage: %s\n", usagemsg);
        else
        {
+               IO::print(IO::cerr, "Builder 1.0\n\n");
                IO::print(IO::cerr, "Usage: %s [options] [<target> ...]\n\n", argv0);
                IO::print(IO::cerr, "Options:\n");
                IO::print(IO::cerr, helpmsg);