summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/UseSWIG.cmake3
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx6
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx3
-rw-r--r--Source/cmMakefile.cxx35
-rw-r--r--Source/cmMakefile.h7
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.cxx12
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h12
7 files changed, 71 insertions, 7 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 2f9af54..6a0f8bf 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -146,7 +146,8 @@ MACRO(SWIG_ADD_MODULE name language)
SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it})
SET(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}")
ENDFOREACH(it)
- SET(ADDITIONAL_MAKE_CLEAN_FILES ${ADDITIONAL_MAKE_CLEAN_FILES} ${swig_generated_sources})
+ SET_DIRECTORY_PROPERTIES(PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES "${ADDITIONAL_MAKE_CLEAN_FILES};${swig_generated_sources}")
ADD_LIBRARY(${SWIG_MODULE_${name}_REAL_NAME}
MODULE
${swig_generated_sources}
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 23b0008..81d249b 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -95,6 +95,12 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
}
else
{
+ const char *prop = m_Makefile->GetProperty(args[1].c_str());
+ if (prop)
+ {
+ m_Makefile->AddDefinition(variable.c_str(), prop);
+ return true;
+ }
std::string emsg = "Unknown directory property: " + args[1];
this->SetError(emsg.c_str());
return false;
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 27dc4af..a22244a 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -646,7 +646,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
}
fout << "\n\n";
const char * additional_clean_files =
- m_Makefile->GetDefinition("ADDITIONAL_MAKE_CLEAN_FILES");
+ m_Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES");
if ( additional_clean_files && strlen(additional_clean_files) > 0 )
{
std::string arg = additional_clean_files;
@@ -659,6 +659,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
}
fout << "\n\n";
}
+
const char * qt_files = m_Makefile->GetDefinition("GENERATED_QT_FILES");
if (qt_files != NULL &&
strlen(m_Makefile->GetDefinition("GENERATED_QT_FILES"))>0)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c85ad61..e10b5ad 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2400,3 +2400,38 @@ bool cmMakefile::CheckInfiniteLoops()
}
return true;
}
+
+void cmMakefile::SetProperty(const char* prop, const char* value)
+{
+ if (!prop)
+ {
+ return;
+ }
+ if (!value)
+ {
+ value = "NOTFOUND";
+ }
+ m_Properties[prop] = value;
+}
+
+const char *cmMakefile::GetProperty(const char* prop) const
+{
+ std::map<cmStdString,cmStdString>::const_iterator i =
+ m_Properties.find(prop);
+ if (i != m_Properties.end())
+ {
+ return i->second.c_str();
+ }
+ return 0;
+}
+
+bool cmMakefile::GetPropertyAsBool(const char* prop) const
+{
+ std::map<cmStdString,cmStdString>::const_iterator i =
+ m_Properties.find(prop);
+ if (i != m_Properties.end())
+ {
+ return cmSystemTools::IsOn(i->second.c_str());
+ }
+ return false;
+}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 8b60aad..d417f74 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -667,6 +667,11 @@ public:
///! Return true if the directory is preorder.
bool IsDirectoryPreOrder(const char* dir);
+ ///! Set/Get a property of this directory
+ void SetProperty(const char *prop, const char *value);
+ const char *GetProperty(const char *prop) const;
+ bool GetPropertyAsBool(const char *prop) const;
+
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const char* name, cmTarget& target);
@@ -743,6 +748,8 @@ private:
DefinitionMap::key_type m_TemporaryDefinitionKey;
cmsys::RegularExpression m_cmDefineRegex;
+
+ std::map<cmStdString,cmStdString> m_Properties;
};
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx
index 4256e62..1c3049c 100644
--- a/Source/cmSetDirectoryPropertiesCommand.cxx
+++ b/Source/cmSetDirectoryPropertiesCommand.cxx
@@ -68,9 +68,15 @@ bool cmSetDirectoryPropertiesCommand::InitialPass(
}
else
{
- std::string emsg = "Unknown directory property: " + args[1];
- this->SetError(emsg.c_str());
- return false;
+ if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
+ {
+ // This property is not inherrited
+ if ( strcmp(m_Makefile->GetCurrentDirectory(), m_Makefile->GetStartDirectory()) != 0 )
+ {
+ continue;
+ }
+ }
+ m_Makefile->SetProperty(prop.c_str(), value.c_str());
}
}
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index d5e5acf..1427235 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -34,6 +34,12 @@ public:
virtual bool InitialPass(std::vector<std::string> const& args);
/**
+ * This determines if the command gets propagated down
+ * to makefiles located in subdirectories.
+ */
+ virtual bool IsInherited() {return true;}
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "SET_DIRECTORY_PROPERTIES";}
@@ -55,8 +61,10 @@ public:
" SET_DIRECTORY_PROPERTIES(PROPERTIES prop1 value1 prop2 value2)\n"
"Set a property for the current directory and subdirectories. If the "
"property is not found, CMake will report an error. The properties "
- "include: INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and "
- "INCLUDE_REGULAR_EXPRESSION.";
+ "include: INCLUDE_DIRECTORIES, LINK_DIRECTORIES, "
+ "INCLUDE_REGULAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES.\n"
+ "ADDITIONAL_MAKE_CLEAN_FILES is a list of files that will be cleaned "
+ "as a part of \"make clean\" stage.";
}
cmTypeMacro(cmSetDirectoryPropertiesCommand, cmCommand);