[cmake-commits] hoffman committed cmCommandArgumentParserHelper.cxx
1.12.2.6 1.12.2.7 cmCommandArgumentParserHelper.h 1.8.2.2
1.8.2.3 cmFileCommand.cxx 1.56.2.6 1.56.2.7 cmFileCommand.h
1.16.2.3 1.16.2.4 cmLocalGenerator.cxx 1.132.2.13 1.132.2.14
cmMakefile.cxx 1.335.2.13 1.335.2.14 cmMakefile.h 1.186.2.5
1.186.2.6 cmake.cxx 1.247.2.9 1.247.2.10
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Jun 29 12:58:20 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv8749/Source
Modified Files:
Tag: CMake-2-4
cmCommandArgumentParserHelper.cxx
cmCommandArgumentParserHelper.h cmFileCommand.cxx
cmFileCommand.h cmLocalGenerator.cxx cmMakefile.cxx
cmMakefile.h cmake.cxx
Log Message:
ENH: RC 11
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.132.2.13
retrieving revision 1.132.2.14
diff -u -d -r1.132.2.13 -r1.132.2.14
--- cmLocalGenerator.cxx 28 May 2007 14:07:04 -0000 1.132.2.13
+++ cmLocalGenerator.cxx 29 Jun 2007 16:58:18 -0000 1.132.2.14
@@ -386,6 +386,18 @@
"ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n"
"\n";
+ // Copy user-specified install options to the install code.
+ if(const char* so_no_exe =
+ this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE"))
+ {
+ fout <<
+ "# Install shared libraries without execute permission?\n"
+ "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
+ "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ "\n";
+ }
+
// Ask each install generator to write its code.
std::vector<cmInstallGenerator*> const& installers =
this->Makefile->GetInstallGenerators();
Index: cmCommandArgumentParserHelper.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentParserHelper.h,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- cmCommandArgumentParserHelper.h 15 Feb 2007 18:36:08 -0000 1.8.2.2
+++ cmCommandArgumentParserHelper.h 29 Jun 2007 16:58:18 -0000 1.8.2.3
@@ -71,7 +71,6 @@
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
- void SetAtOnly(bool b) { this->AtOnly = b; }
const char* GetError() { return this->ErrorString.c_str(); }
char EmptyVariable[1];
@@ -107,7 +106,6 @@
bool NoEscapeMode;
bool ReplaceAtSyntax;
bool RemoveEmpty;
- bool AtOnly;
};
#endif
Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.56.2.6
retrieving revision 1.56.2.7
diff -u -d -r1.56.2.6 -r1.56.2.7
--- cmFileCommand.cxx 28 May 2007 14:07:04 -0000 1.56.2.6
+++ cmFileCommand.cxx 29 Jun 2007 16:58:18 -0000 1.56.2.7
@@ -1162,6 +1162,9 @@
}
}
+ // Choose a default for shared library permissions.
+ bool install_so_no_exe = this->Makefile->IsOn("CMAKE_INSTALL_SO_NO_EXE");
+
// If file permissions were not specified set default permissions
// for this target type.
if(!use_given_permissions_file && !use_source_permissions)
@@ -1170,15 +1173,16 @@
{
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
-#if defined(__linux__)
- // Use read/write permissions.
- permissions_file = 0;
- permissions_file |= mode_owner_read;
- permissions_file |= mode_owner_write;
- permissions_file |= mode_group_read;
- permissions_file |= mode_world_read;
- break;
-#endif
+ if(install_so_no_exe)
+ {
+ // Use read/write permissions.
+ permissions_file = 0;
+ permissions_file |= mode_owner_read;
+ permissions_file |= mode_owner_write;
+ permissions_file |= mode_group_read;
+ permissions_file |= mode_world_read;
+ break;
+ }
case cmTarget::EXECUTABLE:
case cmTarget::INSTALL_PROGRAMS:
// Use read/write/executable permissions.
@@ -1275,10 +1279,10 @@
std::string libname = toFile;
std::string soname = toFile;
std::string soname_nopath = fromName;
- this->ComputeVersionedName(soname, lib_soversion);
- this->ComputeVersionedName(soname_nopath, lib_soversion);
- this->ComputeVersionedName(fromName, lib_version);
- this->ComputeVersionedName(toFile, lib_version);
+ this->ComputeVersionedLibName(soname, lib_soversion);
+ this->ComputeVersionedLibName(soname_nopath, lib_soversion);
+ this->ComputeVersionedLibName(fromName, lib_version);
+ this->ComputeVersionedLibName(toFile, lib_version);
cmSystemTools::RemoveFile(soname.c_str());
cmSystemTools::RemoveFile(libname.c_str());
@@ -1318,22 +1322,14 @@
if ( exe_version )
{
std::string exename = toFile;
- std::string exename_nopath = fromName;
- exename_nopath += "-";
- exename_nopath += exe_version;
-
- fromName += "-";
- fromName += exe_version;
- toFile += "-";
- toFile += exe_version;
-
+ this->ComputeVersionedExeName(fromName, exe_version);
+ this->ComputeVersionedExeName(toFile, exe_version);
cmSystemTools::RemoveFile(exename.c_str());
-
- if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(),
- exename.c_str()) )
+ if(!cmSystemTools::CreateSymlink(fromName.c_str(),
+ exename.c_str()))
{
- std::string errstring = "error when creating symlink from: "
- + exename + " to " + exename_nopath;
+ std::string errstring = "error when creating symlink from: "
+ + exename + " to " + fromName;
this->SetError(errstring.c_str());
return false;
}
@@ -1408,8 +1404,8 @@
}
//----------------------------------------------------------------------------
-void cmFileCommand::ComputeVersionedName(std::string& name,
- const char* version)
+void cmFileCommand::ComputeVersionedLibName(std::string& name,
+ const char* version)
{
#if defined(__APPLE__)
std::string ext;
@@ -1428,6 +1424,21 @@
}
//----------------------------------------------------------------------------
+void cmFileCommand::ComputeVersionedExeName(std::string& name,
+ const char* version)
+{
+ std::string ext;
+ if(name.size() > 4 && name.substr(name.size()-4) == ".exe")
+ {
+ ext = ".exe";
+ name = name.substr(0, name.size()-4);
+ }
+ name += "-";
+ name += version;
+ name += ext;
+}
+
+//----------------------------------------------------------------------------
bool cmFileCommand::HandleRelativePathCommand(
std::vector<std::string> const& args)
{
Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.186.2.5
retrieving revision 1.186.2.6
diff -u -d -r1.186.2.5 -r1.186.2.6
--- cmMakefile.h 13 Oct 2006 14:52:05 -0000 1.186.2.5
+++ cmMakefile.h 29 Jun 2007 16:58:18 -0000 1.186.2.6
@@ -571,14 +571,14 @@
* entry in the this->Definitions map. Also @var@ is
* expanded to match autoconf style expansions.
*/
- const char *ExpandVariablesInString(std::string& source) const;
+ const char *ExpandVariablesInString(std::string& source);
const char *ExpandVariablesInString(std::string& source, bool escapeQuotes,
bool noEscapes,
bool atOnly = false,
const char* filename = 0,
long line = -1,
bool removeEmpty = false,
- bool replaceAt = true) const;
+ bool replaceAt = true);
/**
* Remove any remaining variables in the string. Anything with ${var} or
@@ -774,7 +774,8 @@
bool IsFunctionBlocked(const cmListFileFunction& lff);
private:
-
+ void Initialize();
+
void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
@@ -798,7 +799,8 @@
cmsys::RegularExpression cmDefineRegex;
cmsys::RegularExpression cmDefine01Regex;
-
+ cmsys::RegularExpression cmAtVarRegex;
+
std::map<cmStdString,cmStdString> Properties;
// should this makefile be processed before or after processing the parent
Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.247.2.9
retrieving revision 1.247.2.10
diff -u -d -r1.247.2.9 -r1.247.2.10
--- cmake.cxx 10 Nov 2006 15:12:55 -0000 1.247.2.9
+++ cmake.cxx 29 Jun 2007 16:58:18 -0000 1.247.2.10
@@ -790,7 +790,8 @@
<< " echo_append [string]... - displays arguments as text but no new"
" line\n"
<< " environment - display the current enviroment\n"
- << " remove file1 file2 ... - remove the file(s)\n"
+ << " make_directory dir - create a directory\n"
+ << " remeove file1 file2 ... - remove the file(s)\n"
<< " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar.\n"
<< " time command [args] ... - run command and return elapsed time\n"
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -902,6 +903,17 @@
return 0;
}
#endif
+
+ if (args[1] == "make_directory" && args.size() == 3)
+ {
+ if(!cmSystemTools::MakeDirectory(args[2].c_str()))
+ {
+ std::cerr << "Error making directory \"" << args[2].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
// Remove file
else if (args[1] == "remove" && args.size() > 2)
Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.16.2.3
retrieving revision 1.16.2.4
diff -u -d -r1.16.2.3 -r1.16.2.4
--- cmFileCommand.h 16 Mar 2007 22:05:42 -0000 1.16.2.3
+++ cmFileCommand.h 29 Jun 2007 16:58:18 -0000 1.16.2.4
@@ -125,7 +125,8 @@
bool HandleRelativePathCommand(std::vector<std::string> const& args);
bool HandleCMakePathCommand(std::vector<std::string> const& args,
bool nativePath);
- void ComputeVersionedName(std::string& name, const char* version);
+ void ComputeVersionedLibName(std::string& name, const char* version);
+ void ComputeVersionedExeName(std::string& name, const char* version);
};
Index: cmCommandArgumentParserHelper.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentParserHelper.cxx,v
retrieving revision 1.12.2.6
retrieving revision 1.12.2.7
diff -u -d -r1.12.2.6 -r1.12.2.7
--- cmCommandArgumentParserHelper.cxx 5 Jun 2007 13:30:54 -0000 1.12.2.6
+++ cmCommandArgumentParserHelper.cxx 29 Jun 2007 16:58:18 -0000 1.12.2.7
@@ -38,7 +38,6 @@
this->NoEscapeMode = false;
this->ReplaceAtSyntax = false;
- this->AtOnly = false;
}
@@ -72,18 +71,6 @@
{
return this->ExpandVariable(var);
}
- if(this->AtOnly)
- {
- std::string ref = "$";
- ref += key;
- ref += "{";
- if(var)
- {
- ref += var;
- }
- ref += "}";
- return this->AddString(ref.c_str());
- }
if ( strcmp(key, "ENV") == 0 )
{
char *ptr = getenv(var);
@@ -108,18 +95,6 @@
char* cmCommandArgumentParserHelper::ExpandVariable(const char* var,
bool doingAt)
{
- // if we are in AtOnly mode, and we are not expanding an @ variable
- // then put back the ${var} unexpanded
- if(!doingAt && this->AtOnly)
- {
- std::string ref = "${";
- if(var)
- {
- ref += var;
- }
- ref += "}";
- return this->AddString(ref.c_str());
- }
if(!var)
{
return 0;
Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.335.2.13
retrieving revision 1.335.2.14
diff -u -d -r1.335.2.13 -r1.335.2.14
--- cmMakefile.cxx 17 May 2007 18:41:52 -0000 1.335.2.13
+++ cmMakefile.cxx 29 Jun 2007 16:58:18 -0000 1.335.2.14
@@ -85,9 +85,7 @@
this->AddSourceGroup("Resources", "\\.plist$");
#endif
this->AddDefaultDefinitions();
- this->cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
- this->cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
-
+ this->Initialize();
this->PreOrder = false;
}
@@ -131,6 +129,15 @@
this->Properties = mf.Properties;
this->PreOrder = mf.PreOrder;
this->ListFileStack = mf.ListFileStack;
+ this->Initialize();
+}
+
+//----------------------------------------------------------------------------
+void cmMakefile::Initialize()
+{
+ this->cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
+ this->cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
+ this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)");
}
const char* cmMakefile::GetReleaseVersion()
@@ -1698,7 +1705,7 @@
}
-const char *cmMakefile::ExpandVariablesInString(std::string& source) const
+const char *cmMakefile::ExpandVariablesInString(std::string& source)
{
return this->ExpandVariablesInString(source, false, false);
}
@@ -1710,57 +1717,108 @@
const char* filename,
long line,
bool removeEmpty,
- bool replaceAt) const
+ bool replaceAt)
{
if ( source.empty() || source.find_first_of("$@\\") == source.npos)
{
return source.c_str();
}
+ // Special-case the @ONLY mode.
+ if(atOnly)
+ {
+ if(!noEscapes || !removeEmpty || !replaceAt)
+ {
+ // This case should never be called. At-only is for
+ // configure-file/string which always does no escapes.
+ abort();
+ }
+
+ // Store an original copy of the input.
+ std::string input = source;
+
+ // Start with empty output.
+ source = "";
+
+ // Look for one @VAR@ at a time.
+ const char* in = input.c_str();
+ while(this->cmAtVarRegex.find(in))
+ {
+ // Get the range of the string to replace.
+ const char* first = in + this->cmAtVarRegex.start();
+ const char* last = in + this->cmAtVarRegex.end();
+
+ // Store the unchanged part of the string now.
+ source.append(in, first-in);
+
+ // Lookup the definition of VAR.
+ std::string var(first+1, last-first-2);
+ if(const char* val = this->GetDefinition(var.c_str()))
+ {
+ // Store the value in the output escaping as requested.
+ if(escapeQuotes)
+ {
+ source.append(cmSystemTools::EscapeQuotes(val));
+ }
+ else
+ {
+ source.append(val);
+ }
+ }
+
+ // Continue looking for @VAR@ further along the string.
+ in = last;
+ }
+
+ // Append the rest of the unchanged part of the string.
+ source.append(in);
+
+ return source.c_str();
+ }
+
// This method replaces ${VAR} and @VAR@ where VAR is looked up
// with GetDefinition(), if not found in the map, nothing is expanded.
// It also supports the $ENV{VAR} syntax where VAR is looked up in
// the current environment variables.
-
- cmCommandArgumentParserHelper parser;
- parser.SetMakefile(this);
- parser.SetLineFile(line, filename);
- parser.SetEscapeQuotes(escapeQuotes);
- parser.SetNoEscapeMode(noEscapes);
- parser.SetReplaceAtSyntax(replaceAt);
+
+ cmCommandArgumentParserHelper parser;
+ parser.SetMakefile(this);
+ parser.SetLineFile(line, filename);
+ parser.SetEscapeQuotes(escapeQuotes);
+ parser.SetNoEscapeMode(noEscapes);
+ parser.SetReplaceAtSyntax(replaceAt);
parser.SetRemoveEmpty(removeEmpty);
- parser.SetAtOnly(atOnly);
- int res = parser.ParseString(source.c_str(), 0);
- if ( res )
+ int res = parser.ParseString(source.c_str(), 0);
+ if ( res )
+ {
+ source = parser.GetResult();
+ }
+ else
+ {
+ cmOStringStream error;
+ error << "Syntax error in cmake code at\n"
+ << (filename?filename:"(no filename given)")
+ << ":" << line << ":\n"
+ << parser.GetError() << ", when parsing string \""
+ << source.c_str() << "\"";
+ const char* versionValue
+ = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
+ int major = 0;
+ int minor = 0;
+ if ( versionValue )
{
- source = parser.GetResult();
+ sscanf(versionValue, "%d.%d", &major, &minor);
+ }
+ if ( major < 2 || major == 2 && minor < 1 )
+ {
+ cmSystemTools::Error(error.str().c_str());
+ cmSystemTools::SetFatalErrorOccured();
+ return source.c_str();
}
else
{
- cmOStringStream error;
- error << "Syntax error in cmake code at\n"
- << (filename?filename:"(no filename given)")
- << ":" << line << ":\n"
- << parser.GetError() << ", when parsing string \""
- << source.c_str() << "\"";
- const char* versionValue
- = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
- int major = 0;
- int minor = 0;
- if ( versionValue )
- {
- sscanf(versionValue, "%d.%d", &major, &minor);
- }
- if ( major < 2 || major == 2 && minor < 1 )
- {
- cmSystemTools::Error(error.str().c_str());
- cmSystemTools::SetFatalErrorOccured();
- return source.c_str();
- }
- else
- {
- cmSystemTools::Message(error.str().c_str());
- }
+ cmSystemTools::Message(error.str().c_str());
}
+ }
return source.c_str();
}
More information about the Cmake-commits
mailing list