summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0046.rst17
-rw-r--r--Modules/CheckTypeSize.cmake2
-rw-r--r--Modules/FindJNI.cmake1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmAddDependenciesCommand.cxx2
-rw-r--r--Source/cmComputeLinkDepends.h2
-rw-r--r--Source/cmComputeTargetDepends.cxx39
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGlobalGenerator.cxx134
-rw-r--r--Source/cmGlobalGenerator.h32
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx29
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmTarget.cxx20
-rw-r--r--Source/cmTarget.h4
-rw-r--r--Source/cmake.cxx5
-rw-r--r--Tests/FindPackageModeMakefileTest/Makefile.in4
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt13
-rw-r--r--Tests/InterfaceLibrary/map_config.cpp15
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake5
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt1
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake4
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake5
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake4
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake2
-rw-r--r--Tests/RunCMake/CMP0046/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0046/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeLists.txt.orig142
40 files changed, 301 insertions, 234 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 4bee05e..891333c 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -97,3 +97,4 @@ All Policies
/policy/CMP0043
/policy/CMP0044
/policy/CMP0045
+ /policy/CMP0046
diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst
new file mode 100644
index 0000000..5192dc7
--- /dev/null
+++ b/Help/policy/CMP0046.rst
@@ -0,0 +1,17 @@
+CMP0046
+-------
+
+Error on non-existent dependency in add_dependencies.
+
+CMake 2.8.12 and lower silently ignored non-existent dependencies
+listed in the :command:`add_dependencies` command.
+
+The OLD behavior for this policy is to silently ignore non-existent
+dependencies. The NEW behavior for this policy is to report an error
+if non-existent dependencies are listed in the :command:`add_dependencies`
+command.
+
+This policy was introduced in CMake version 3.0.0.
+CMake version |release| warns when the policy is not set and uses
+OLD behavior. Use the cmake_policy command to set it to OLD or
+NEW explicitly.
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index a9efae4..ec28d8b 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -222,6 +222,8 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
endif()
+ unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
+ unset(_CHECK_TYPE_SIZE_LANGUAGE)
# Compute or load the size or size map.
set(${VARIABLE}_KEYS)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 29a247d..f1cb57e 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -238,6 +238,7 @@ find_path(JAVA_INCLUDE_PATH jni.h
find_path(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_INCLUDE_PATH}
+ ${JAVA_INCLUDE_PATH}/darwin
${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux
${JAVA_INCLUDE_PATH}/freebsd
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 3b0f3c0..0cdba30 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20140110)
+set(CMake_VERSION_TWEAK 20140113)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 87bfb3c..a7ffded 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -46,7 +46,7 @@ bool cmAddDependenciesCommand
++s; // skip over target_name
for (; s != args.end(); ++s)
{
- target->AddUtility(s->c_str());
+ target->AddUtility(s->c_str(), this->Makefile);
}
}
else
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index cf227fb..9776f55 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -63,7 +63,7 @@ private:
cmTarget const* HeadTarget;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
- cmGlobalGenerator* GlobalGenerator;
+ cmGlobalGenerator const* GlobalGenerator;
cmake* CMakeInstance;
bool DebugMode;
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 73a8e27..a848e4f 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -343,6 +343,45 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
cmTarget const* dependee =
depender->GetMakefile()->FindTargetToUse(dependee_name);
+ if(!dependee && !linking &&
+ (depender->GetType() != cmTarget::GLOBAL_TARGET))
+ {
+ cmMakefile *makefile = depender->GetMakefile();
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ bool issueMessage = false;
+ switch(makefile->GetPolicyStatus(cmPolicies::CMP0046))
+ {
+ case cmPolicies::WARN:
+ issueMessage = true;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
+ }
+ if(issueMessage)
+ {
+ cmake* cm = this->GlobalGenerator->GetCMakeInstance();
+ cmOStringStream e;
+ e << (makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n";
+ e << "The dependency target \"" << dependee_name
+ << "\" of target \"" << depender->GetName() << "\" does not exist.";
+
+ cmListFileBacktrace nullBacktrace;
+ cmListFileBacktrace const* backtrace =
+ depender->GetUtilityBacktrace(dependee_name);
+ if(!backtrace)
+ {
+ backtrace = &nullBacktrace;
+ }
+
+ cm->IssueMessage(messageType, e.str(), *backtrace);
+ }
+ }
+
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 5cd1f42..0fcee3e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -469,7 +469,7 @@ private:
cmTarget* Target;
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;
- cmGlobalGenerator* GlobalGenerator;
+ cmGlobalGenerator const* GlobalGenerator;
typedef cmGeneratorTarget::SourceEntry SourceEntry;
SourceEntry* CurrentEntry;
std::queue<cmSourceFile*> SourceQueue;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 17a223a..a4caba1 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -50,7 +50,7 @@ public:
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
- cmGlobalGenerator* GlobalGenerator;
+ cmGlobalGenerator const* GlobalGenerator;
std::string ModuleDefinitionFile;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f883fbe..8a7eee4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -90,7 +90,7 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts)
}
std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram,
- std::string makeDefault)
+ std::string makeDefault) const
{
if(cmSystemTools::IsOff(makeProgram))
{
@@ -111,7 +111,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram,
void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
cmMakefile *mf,
- bool optional)
+ bool optional) const
{
std::string langComp = "CMAKE_";
langComp += lang;
@@ -723,7 +723,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
//----------------------------------------------------------------------------
void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
std::string lang,
- const char* envVar)
+ const char* envVar) const
{
// Subclasses override this method if they do not support this advice.
os <<
@@ -744,7 +744,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
//----------------------------------------------------------------------------
void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
- std::string lang)
+ std::string lang) const
{
std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID";
const char* compilerId = mf->GetDefinition(compilerIdVar.c_str());
@@ -782,13 +782,16 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
//----------------------------------------------------------------------------
const char*
-cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source)
+cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
{
if(const char* lang = source.GetLanguage())
{
- if(this->LanguageToOutputExtension.count(lang) > 0)
+ std::map<cmStdString, cmStdString>::const_iterator it =
+ this->LanguageToOutputExtension.find(lang);
+
+ if(it != this->LanguageToOutputExtension.end())
{
- return this->LanguageToOutputExtension[lang].c_str();
+ return it->second.c_str();
}
}
else
@@ -809,7 +812,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source)
}
-const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext)
+const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
{
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
@@ -817,9 +820,11 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext)
{
++ext;
}
- if(this->ExtensionToLanguage.count(ext) > 0)
+ std::map<cmStdString, cmStdString>::const_iterator it
+ = this->ExtensionToLanguage.find(ext);
+ if(it != this->ExtensionToLanguage.end())
{
- return this->ExtensionToLanguage[ext].c_str();
+ return it->second.c_str();
}
return 0;
}
@@ -943,7 +948,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
}
}
-bool cmGlobalGenerator::IgnoreFile(const char* l)
+bool cmGlobalGenerator::IgnoreFile(const char* l) const
{
if(this->GetLanguageFromExtension(l))
{
@@ -966,15 +971,22 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
cmTarget const* targetIn)
{
// Get all local gens for this project
- std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator it =
+ this->ProjectMap.find(project);
+ if (it == this->ProjectMap.end())
+ {
+ return false;
+ }
+
// loop over local gens and get the targets for each one
- for(unsigned int i = 0; i < gens->size(); ++i)
+ for(std::vector<cmLocalGenerator*>::const_iterator geIt = it->second.begin();
+ geIt != it->second.end(); ++geIt)
{
- cmTargets& targets = (*gens)[i]->GetMakefile()->GetTargets();
- for (cmTargets::iterator l = targets.begin();
+ cmTargets const& targets = (*geIt)->GetMakefile()->GetTargets();
+ for (cmTargets::const_iterator l = targets.begin();
l != targets.end(); l++)
{
- cmTarget& target = l->second;
+ cmTarget const& target = l->second;
TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
if(tgtdeps.count(targetIn))
{
@@ -1064,7 +1076,7 @@ void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
this->CMP0042WarnTargets.insert(target);
}
-bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
+bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
{
// If the property is not enabled then okay.
if(!this->CMakeInstance
@@ -1375,35 +1387,37 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
}
//----------------------------------------------------------------------------
+void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf)
+{
+ cmGeneratorTargetsType generatorTargets;
+ cmTargets& targets = mf->GetTargets();
+ for(cmTargets::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ cmTarget* t = &ti->second;
+ cmGeneratorTarget* gt = new cmGeneratorTarget(t);
+ this->GeneratorTargets[t] = gt;
+ generatorTargets[t] = gt;
+ }
+
+ for(std::vector<cmTarget*>::const_iterator
+ j = mf->GetOwnedImportedTargets().begin();
+ j != mf->GetOwnedImportedTargets().end(); ++j)
+ {
+ cmGeneratorTarget* gt = new cmGeneratorTarget(*j);
+ this->GeneratorTargets[*j] = gt;
+ generatorTargets[*j] = gt;
+ }
+ mf->SetGeneratorTargets(generatorTargets);
+}
+
+//----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets()
{
// Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
- cmGeneratorTargetsType generatorTargets;
-
- cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
-
- cmTargets& targets = mf->GetTargets();
- for(cmTargets::iterator ti = targets.begin();
- ti != targets.end(); ++ti)
- {
- cmTarget* t = &ti->second;
- cmGeneratorTarget* gt = new cmGeneratorTarget(t);
- this->GeneratorTargets[t] = gt;
- generatorTargets[t] = gt;
- }
-
- for(std::vector<cmTarget*>::const_iterator
- j = mf->GetOwnedImportedTargets().begin();
- j != mf->GetOwnedImportedTargets().end(); ++j)
- {
- cmGeneratorTarget* gt = new cmGeneratorTarget(*j);
- this->GeneratorTargets[*j] = gt;
- generatorTargets[*j] = gt;
- }
-
- mf->SetGeneratorTargets(generatorTargets);
+ this->CreateGeneratorTargets(this->LocalGenerators[i]->GetMakefile());
}
}
@@ -1897,7 +1911,7 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
- cmLocalGenerator* gen)
+ cmLocalGenerator* gen) const
{
if(!gen || gen == root)
{
@@ -1917,7 +1931,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
- cmTarget& target)
+ cmTarget const& target) const
{
if(target.GetType() == cmTarget::INTERFACE_LIBRARY
|| target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
@@ -1933,16 +1947,17 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
}
}
-void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
+void
+cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
{
- for(std::map<cmStdString, bool>::iterator i =
+ for(std::map<cmStdString, bool>::const_iterator i =
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
{
lang.push_back(i->first);
}
}
-int cmGlobalGenerator::GetLinkerPreference(const char* lang)
+int cmGlobalGenerator::GetLinkerPreference(const char* lang) const
{
std::map<cmStdString, int>::const_iterator it =
this->LanguageToLinkerPreference.find(lang);
@@ -1988,10 +2003,10 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
{
cmLocalGenerator* lg = *lgi;
cmMakefile* mf = lg->GetMakefile();
- cmTargets& targets = mf->GetTargets();
- for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+ cmTargets const& targets = mf->GetTargets();
+ for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
{
- cmTarget& target = t->second;
+ cmTarget const& target = t->second;
// Consider the directory containing the target and all its
// parents until something excludes the target.
@@ -2020,15 +2035,16 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
///! Find a local generator by its startdirectory
-cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(const char* start_dir)
+cmLocalGenerator*
+cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const
{
- std::vector<cmLocalGenerator*>* gens = &this->LocalGenerators;
- for(unsigned int i = 0; i < gens->size(); ++i)
+ for(std::vector<cmLocalGenerator*>::const_iterator it =
+ this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it)
{
- std::string sd = (*gens)[i]->GetMakefile()->GetStartDirectory();
+ std::string sd = (*it)->GetMakefile()->GetStartDirectory();
if (sd == start_dir)
{
- return (*gens)[i];
+ return *it;
}
}
return 0;
@@ -2511,11 +2527,13 @@ cmGlobalGenerator::GenerateRuleFile(std::string const& output) const
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
- std::string const& l)
+ std::string const& l) const
{
- if(this->LanguageToOriginalSharedLibFlags.count(l) > 0)
+ std::map<cmStdString, cmStdString>::const_iterator it =
+ this->LanguageToOriginalSharedLibFlags.find(l);
+ if(it != this->LanguageToOriginalSharedLibFlags.end())
{
- return this->LanguageToOriginalSharedLibFlags[l];
+ return it->second;
}
return "";
}
@@ -2646,7 +2664,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target)
+bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
{
return (target->GetType() == cmTarget::GLOBAL_TARGET ||
strcmp(target->GetName(), this->GetAllTargetName()) == 0);
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index fc5cab9..ebc2db5 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -80,7 +80,7 @@ public:
void SetLanguageEnabled(const char*, cmMakefile* mf);
bool GetLanguageEnabled(const char*) const;
void ClearEnabledLanguages();
- void GetEnabledLanguages(std::vector<std::string>& lang);
+ void GetEnabledLanguages(std::vector<std::string>& lang) const;
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
@@ -93,7 +93,7 @@ public:
* Intended to be called from EnableLanguage.
*/
void ResolveLanguageCompiler(const std::string &lang, cmMakefile *mf,
- bool optional);
+ bool optional) const;
/**
* Try to determine system infomation, get it from another generator
@@ -182,13 +182,13 @@ public:
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
///! return the language for the given extension
- const char* GetLanguageFromExtension(const char* ext);
+ const char* GetLanguageFromExtension(const char* ext) const;
///! is an extension to be ignored
- bool IgnoreFile(const char* ext);
+ bool IgnoreFile(const char* ext) const;
///! What is the preference for linkers and this language (None or Prefered)
- int GetLinkerPreference(const char* lang);
+ int GetLinkerPreference(const char* lang) const;
///! What is the object file extension for a given source file?
- const char* GetLanguageOutputExtension(cmSourceFile const&);
+ const char* GetLanguageOutputExtension(cmSourceFile const&) const;
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGIntDir() const { return "."; }
@@ -220,7 +220,7 @@ public:
target in the project */
bool IsDependedOn(const char* project, cmTarget const* target);
///! Find a local generator by its startdirectory
- cmLocalGenerator* FindLocalGenerator(const char* start_dir);
+ cmLocalGenerator* FindLocalGenerator(const char* start_dir) const;
/** Append the subdirectory for the given configuration. If anything is
appended the given prefix and suffix will be appended around it, which
@@ -293,7 +293,7 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return false; }
- std::string GetSharedLibFlagsForLanguage(std::string const& lang);
+ std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
/** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const;
@@ -325,7 +325,7 @@ protected:
virtual void GetTargetSets(TargetDependSet& projectTargets,
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
- virtual bool IsRootOnlyTarget(cmTarget* target);
+ bool IsRootOnlyTarget(cmTarget* target) const;
void AddTargetDepends(cmTarget const* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
@@ -334,7 +334,7 @@ protected:
virtual bool ComputeTargetDepends();
- virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
+ virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
bool CheckTargets();
typedef std::vector<std::pair<cmQtAutoGenerators,
@@ -342,14 +342,14 @@ protected:
void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
std::string SelectMakeProgram(const char* makeProgram,
- std::string makeDefault = "");
+ std::string makeDefault = "") const;
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
void CheckLocalGenerators();
- bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
- bool IsExcluded(cmLocalGenerator* root, cmTarget& target);
+ bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
+ bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const;
void FillLocalGeneratorToTargetMap();
void CreateDefaultGlobalTargets(cmTargets* targets);
cmTarget CreateGlobalTarget(const char* name, const char* message,
@@ -418,8 +418,8 @@ private:
void FinalizeTargetCompileInfo();
virtual void PrintCompilerAdvice(std::ostream& os, std::string lang,
- const char* envVar);
- void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang);
+ const char* envVar) const;
+ void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const;
cmExternalMakefileProjectGenerator* ExtraGenerator;
@@ -432,6 +432,8 @@ private:
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
+ friend class cmake;
+ void CreateGeneratorTargets(cmMakefile* mf);
void CreateGeneratorTargets();
void ComputeGeneratorTargetObjects();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index ec91b0f..65b01db 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1107,27 +1107,46 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
/*deptype=*/ "",
/*rspfile=*/ "",
/*rspcontent*/ "",
- /*restat=*/ false,
+ /*restat=*/ true,
/*generator=*/ true);
- cmNinjaDeps implicitDeps;
+ cmNinjaDeps implicitDeps, outputs, temp;
+ outputs.push_back(NINJA_BUILD_FILE);
for (std::vector<cmLocalGenerator *>::const_iterator i =
this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) {
const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles();
implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end());
const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles();
- implicitDeps.insert(implicitDeps.end(), of.begin(), of.end());
+ temp.insert(temp.end(), of.begin(), of.end());
}
+
+ //Add the CMakeCache.txt file to the implicit depends so that we catch
+ //when somebody manually modifies the file.
+ implicitDeps.push_back("CMakeCache.txt");
+
+ //make sure nothing is in implicit depends twice
std::sort(implicitDeps.begin(), implicitDeps.end());
implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()),
implicitDeps.end());
- implicitDeps.push_back("CMakeCache.txt");
+
+
+ //make sure nothing is in outputs depends twice
+ std::sort(temp.begin(), temp.end());
+ temp.erase(std::unique(temp.begin(), temp.end()),
+ temp.end());
+
+ //make sure that anything that is in implicitDeps is also NOT in outputs
+ std::set_difference(temp.begin(),
+ temp.end(),
+ implicitDeps.begin(),
+ implicitDeps.end(),
+ std::back_inserter(outputs));
this->WriteBuild(os,
"Re-run CMake if any of its inputs changed.",
"RERUN_CMAKE",
- /*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE),
+ outputs,
/*explicitDeps=*/ cmNinjaDeps(),
implicitDeps,
/*orderOnlyDeps=*/ cmNinjaDeps(),
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index de38923..0d5fb44 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -304,7 +304,7 @@ protected:
/// Overloaded methods.
/// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
- virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
+ virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
private:
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 00a86eb..9173751 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -161,7 +161,7 @@ protected:
const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; }
const char* GetCleanTargetName() const { return "clean"; }
- virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
+ virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
// Some make programs (Borland) do not keep a rule if there are no
// dependencies or commands. This is a problem for creating rules
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 54e3c28..eab613d 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -110,7 +110,7 @@ protected:
private:
virtual std::string GetVSMakeProgram() = 0;
- void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
+ void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void FollowLinkDepends(cmTarget const* target,
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 6281c3b..ae7f07e 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -212,7 +212,7 @@ protected:
std::vector<cmXCodeObject*> XCodeObjects;
cmXCodeObject* RootObject;
private:
- void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
+ void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
std::string GetObjectsNormalDirectory(
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 5a189f8..020a782 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -331,6 +331,11 @@ cmPolicies::cmPolicies()
CMP0045, "CMP0045",
"Error on non-existent target in get_target_property.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0046, "CMP0046",
+ "Error on non-existent dependency in add_dependencies.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index b1342bf..38f47f1 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -99,6 +99,7 @@ public:
CMP0043, ///< Ignore COMPILE_DEFINITIONS_<Config> properties
CMP0044, ///< Case sensitive <LANG>_COMPILER_ID generator expressions
CMP0045, ///< Error on non-existent target in get_target_property
+ CMP0046, ///< Error on non-existent dependency in add_dependencies
/** \brief Always the last entry.
*
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4828d20..24fa0c5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -402,6 +402,26 @@ void cmTarget::SetMakefile(cmMakefile* mf)
}
//----------------------------------------------------------------------------
+void cmTarget::AddUtility(const char *u, cmMakefile *makefile)
+{
+ this->Utilities.insert(u);
+ if(makefile)
+ {
+ makefile->GetBacktrace(UtilityBacktraces[u]);
+ }
+}
+
+//----------------------------------------------------------------------------
+cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(const char *u) const
+{
+ std::map<cmStdString, cmListFileBacktrace>::const_iterator i =
+ this->UtilityBacktraces.find(u);
+ if(i == this->UtilityBacktraces.end()) return 0;
+
+ return &i->second;
+}
+
+//----------------------------------------------------------------------------
void cmTarget::FinishConfigure()
{
// Erase any cached link information that might have been comptued
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 26d391f..ce0d812 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -242,9 +242,10 @@ public:
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
* commands. It is not a full path nor does it have an extension.
*/
- void AddUtility(const char* u) { this->Utilities.insert(u);}
+ void AddUtility(const char* u, cmMakefile *makefile = 0);
///! Get the utilities used by this target
std::set<cmStdString>const& GetUtilities() const { return this->Utilities; }
+ cmListFileBacktrace const* GetUtilityBacktrace(const char* u) const;
/** Finalize the target at the end of the Configure step. */
void FinishConfigure();
@@ -691,6 +692,7 @@ private:
std::string RuntimeInstallPath;
mutable std::string ExportMacro;
std::set<cmStdString> Utilities;
+ std::map<cmStdString, cmListFileBacktrace> UtilityBacktraces;
bool RecordDependencies;
mutable cmPropertyMap Properties;
LinkLibraryVectorType OriginalLinkLibraries;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 8e52f96..33fb0fc 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -594,9 +594,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath;
std::string flags;
std::string linkFlags;
- cmGeneratorTarget gtgt(tgt);
+ gg->CreateGeneratorTargets(mf);
+ cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt);
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
- &gtgt);
+ gtgt);
linkLibs = frameworkPath + linkPath + linkLibs;
printf("%s\n", linkLibs.c_str() );
diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in
index c91d8a0..e4df9d6 100644
--- a/Tests/FindPackageModeMakefileTest/Makefile.in
+++ b/Tests/FindPackageModeMakefileTest/Makefile.in
@@ -9,9 +9,9 @@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_D
tmp = tmp.txt
-all: clean pngtest
+all: pngtest
-main.o: main.cpp
+main.o: clean main.cpp
@$(CMAKE_FOO) -DMODE=COMPILE >$(tmp)
@foo="`cat $(tmp)`"; \
printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CXXFLAGS)" "$$foo" >$(tmp)
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index b396eb6..81b34e6 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -29,3 +29,16 @@ target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTO
add_executable(exec_whitelist dummy.cpp)
target_link_libraries(exec_whitelist iface_whitelist)
+
+add_library(iface_imported INTERFACE IMPORTED)
+set_property(TARGET iface_imported PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS
+ $<$<CONFIG:SPECIAL>:SPECIAL_MODE>
+ $<$<CONFIG:Debug>:DEBUG_MODE>
+)
+set_property(TARGET iface_imported PROPERTY
+ MAP_IMPORTED_CONFIG_DEBUG SPECIAL
+)
+
+add_executable(map_config map_config.cpp)
+target_link_libraries(map_config iface_imported)
diff --git a/Tests/InterfaceLibrary/map_config.cpp b/Tests/InterfaceLibrary/map_config.cpp
new file mode 100644
index 0000000..81bb666
--- /dev/null
+++ b/Tests/InterfaceLibrary/map_config.cpp
@@ -0,0 +1,15 @@
+
+#ifdef DEBUG_MODE
+#ifndef SPECIAL_MODE
+#error Special configuration should be mapped to debug configuration.
+#endif
+#else
+#ifdef SPECIAL_MODE
+#error Special configuration should not be enabled if not debug configuration
+#endif
+#endif
+
+int main(int,char**)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake
new file mode 100644
index 0000000..0be290a
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-existing-dependency.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0046 NEW)
+
+add_custom_target(foo)
+add_custom_target(bar)
+add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt
new file mode 100644
index 0000000..0c23c43
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0046-NEW-missing-dependency.cmake:4 \(add_dependencies\):
+ Policy CMP0046 is not set: Error on non-existent dependency in
+ add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
++
+ The dependency target "bar" of target "foo" does not exist.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake
new file mode 100644
index 0000000..9bb6b90
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency.cmake
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0046 NEW)
+
+add_custom_target(foo)
+add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake
new file mode 100644
index 0000000..b22ab4f
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-existing-dependency.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0046 OLD)
+
+add_custom_target(foo)
+add_custom_target(bar)
+add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake
new file mode 100644
index 0000000..5ee3cb7
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-OLD-missing-dependency.cmake
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0046 OLD)
+
+add_custom_target(foo)
+add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt
new file mode 100644
index 0000000..fed36f1
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMP0046-WARN-missing-dependency.cmake:2 \(add_dependencies\):
+ Policy CMP0046 is not set: Error on non-existent dependency in
+ add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
++
+ The dependency target "bar" of target "foo" does not exist.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake
new file mode 100644
index 0000000..896fa40
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMP0046-WARN-missing-dependency.cmake
@@ -0,0 +1,2 @@
+add_custom_target(foo)
+add_dependencies(foo bar)
diff --git a/Tests/RunCMake/CMP0046/CMakeLists.txt b/Tests/RunCMake/CMP0046/CMakeLists.txt
new file mode 100644
index 0000000..2f10cb0
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0046/RunCMakeTest.cmake b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake
new file mode 100644
index 0000000..5131e5b
--- /dev/null
+++ b/Tests/RunCMake/CMP0046/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(CMP0046-OLD-missing-dependency)
+run_cmake(CMP0046-NEW-missing-dependency)
+run_cmake(CMP0046-WARN-missing-dependency)
+
+run_cmake(CMP0046-OLD-existing-dependency)
+run_cmake(CMP0046-NEW-existing-dependency)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 77700d7..1c23bcd 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -66,6 +66,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
endif()
add_RunCMake_test(CMP0043)
add_RunCMake_test(CMP0045)
+add_RunCMake_test(CMP0046)
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
diff --git a/Tests/RunCMake/CMakeLists.txt.orig b/Tests/RunCMake/CMakeLists.txt.orig
deleted file mode 100644
index 96b0543..0000000
--- a/Tests/RunCMake/CMakeLists.txt.orig
+++ /dev/null
@@ -1,142 +0,0 @@
-# This directory contains tests that run CMake to configure a project
-# but do not actually build anything. To add a test:
-#
-# 1.) Add a subdirectory named for the test.
-#
-# 2.) Call add_RunCMake_test and pass the test directory name.
-#
-# 3.) Create a RunCMakeTest.cmake script in the directory containing
-# include(RunCMake)
-# run_cmake(SubTest1)
-# ...
-# run_cmake(SubTestN)
-# where SubTest1..SubTestN are sub-test names each corresponding to
-# an independent CMake run and project configuration.
-#
-# 3.) Create a CMakeLists.txt file in the directory containing
-# cmake_minimum_required(...)
-# project(${RunCMake_TEST} NONE) # or languages needed
-# include(${RunCMake_TEST}.cmake)
-# where "${RunCMake_TEST}" is literal. A value for RunCMake_TEST
-# will be passed to CMake by the run_cmake macro when running each
-# sub-test.
-#
-# 4.) Create a <SubTest>.cmake file for each sub-test named above
-# containing the actual test code. Optionally create files
-# containing expected test results:
-# <SubTest>-result.txt = Process result expected if not "0"
-# <SubTest>-stdout.txt = Regex matching expected stdout content
-# <SubTest>-stderr.txt = Regex matching expected stderr content
-# <SubTest>-check.cmake = Custom result check
-# Note that trailing newlines will be stripped from actual and expected test
-# output before matching against the stdout and stderr expressions.
-# The code in <SubTest>-check.cmake may use variables
-# RunCMake_TEST_SOURCE_DIR = Top of test source tree
-# RunCMake_TEST_BINARY_DIR = Top of test binary tree
-# and an failure must store a message in RunCMake_TEST_FAILED.
-
-macro(add_RunCMake_test test)
- add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND}
- -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
- -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR}
- -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
- -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
- -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
- ${${test}_ARGS}
- -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
- )
-endmacro()
-
-if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
- set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
-endif()
-
-add_RunCMake_test(CMP0019)
-add_RunCMake_test(CMP0022)
-add_RunCMake_test(CMP0026)
-add_RunCMake_test(CMP0027)
-add_RunCMake_test(CMP0028)
-add_RunCMake_test(CMP0037)
-add_RunCMake_test(CMP0038)
-add_RunCMake_test(CMP0039)
-add_RunCMake_test(CMP0040)
-add_RunCMake_test(CMP0041)
-add_RunCMake_test(CTest)
-if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
- add_RunCMake_test(CompilerChange)
-endif()
-add_RunCMake_test(CompilerNotFound)
-add_RunCMake_test(Configure)
-add_RunCMake_test(DisallowedCommands)
-add_RunCMake_test(ExternalData)
-add_RunCMake_test(FPHSA)
-add_RunCMake_test(GeneratorExpression)
-add_RunCMake_test(GeneratorToolset)
-add_RunCMake_test(TargetPropertyGeneratorExpressions)
-add_RunCMake_test(Languages)
-add_RunCMake_test(ObjectLibrary)
-if(NOT WIN32)
- add_RunCMake_test(PositionIndependentCode)
- set(SKIP_VISIBILITY 0)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2)
- set(SKIP_VISIBILITY 1)
- endif()
-
- if (CMAKE_CXX_COMPILER_ID MATCHES Watcom
- OR CMAKE_SYSTEM_NAME MATCHES IRIX64
- OR CMAKE_CXX_COMPILER_ID MATCHES HP
- OR CMAKE_CXX_COMPILER_ID MATCHES XL
- OR CMAKE_CXX_COMPILER_ID MATCHES SunPro)
- set(SKIP_VISIBILITY 1)
- endif()
-
- if (NOT SKIP_VISIBILITY)
- add_RunCMake_test(VisibilityPreset)
- endif()
-endif()
-if (QT4_FOUND)
- set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
-endif()
-add_RunCMake_test(CompatibleInterface)
-add_RunCMake_test(Syntax)
-
-add_RunCMake_test(add_dependencies)
-add_RunCMake_test(build_command)
-add_RunCMake_test(export)
-add_RunCMake_test(cmake_minimum_required)
-add_RunCMake_test(find_package)
-add_RunCMake_test(get_filename_component)
-add_RunCMake_test(if)
-add_RunCMake_test(include)
-add_RunCMake_test(include_directories)
-add_RunCMake_test(list)
-add_RunCMake_test(message)
-add_RunCMake_test(string)
-add_RunCMake_test(try_compile)
-add_RunCMake_test(set)
-add_RunCMake_test(variable_watch)
-add_RunCMake_test(CMP0004)
-add_RunCMake_test(TargetPolicies)
-add_RunCMake_test(alias_targets)
-add_RunCMake_test(interface_library)
-add_RunCMake_test(no_install_prefix)
-
-find_package(Qt4 QUIET)
-find_package(Qt5Core QUIET)
-if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
- add_RunCMake_test(IncompatibleQt)
-endif()
-if (QT4_FOUND)
- set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
- add_RunCMake_test(ObsoleteQtMacros)
-endif()
-
-if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
- add_RunCMake_test(include_external_msproject)
- add_RunCMake_test(SolutionGlobalSections)
-endif()
-
-add_RunCMake_test(File_Generate)
-add_RunCMake_test(ExportWithoutLanguage)
-add_RunCMake_test(target_link_libraries)
-add_RunCMake_test(CheckModules)