VS: Remove AddPlatformDefinitions from platform-specific generators

Move the logic for handling platform specific defines from the
subclasses into the cmGlobalVisualStudioGenerator base class.
This commit is contained in:
Patrick Gansterer 2012-11-19 17:21:47 +01:00 committed by Brad King
parent 5170a8800f
commit 6f439b30cb
14 changed files with 13 additions and 72 deletions

View File

@ -17,6 +17,7 @@
cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator()
{
this->ArchitectureId = "x64";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_IA64";
}
//----------------------------------------------------------------------------
@ -28,14 +29,6 @@ void cmGlobalVisualStudio10IA64Generator
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10IA64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10IA64Generator
::EnableLanguage(std::vector<std::string> const& languages,

View File

@ -33,8 +33,6 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
};

View File

@ -17,6 +17,7 @@
cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
{
this->ArchitectureId = "x64";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_WIN64";
}
//----------------------------------------------------------------------------
@ -28,14 +29,6 @@ void cmGlobalVisualStudio10Win64Generator
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Win64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Win64Generator
::EnableLanguage(std::vector<std::string> const& languages,

View File

@ -33,8 +33,6 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
};

View File

@ -17,6 +17,7 @@
cmGlobalVisualStudio11Win64Generator::cmGlobalVisualStudio11Win64Generator()
{
this->ArchitectureId = "x64";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_WIN64";
}
//----------------------------------------------------------------------------
@ -27,11 +28,3 @@ void cmGlobalVisualStudio11Win64Generator
entry.Brief = "Generates Visual Studio 11 Win64 project files.";
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio11Win64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
}

View File

@ -32,7 +32,5 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
virtual void AddPlatformDefinitions(cmMakefile* mf);
};
#endif

View File

@ -20,6 +20,7 @@
cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
{
this->ArchitectureId = "x64";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_WIN64";
}
//----------------------------------------------------------------------------
@ -30,11 +31,3 @@ void cmGlobalVisualStudio8Win64Generator
entry.Brief = "Generates Visual Studio 8 2005 Win64 project files.";
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Win64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
}

View File

@ -38,11 +38,5 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
virtual void AddPlatformDefinitions(cmMakefile *);
};
#endif

View File

@ -17,6 +17,7 @@
cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator()
{
this->ArchitectureId = "Itanium";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_IA64";
}
//----------------------------------------------------------------------------
@ -27,11 +28,3 @@ void cmGlobalVisualStudio9IA64Generator
entry.Brief = "Generates Visual Studio 9 2008 Itanium project files.";
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio9IA64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
}

View File

@ -38,11 +38,5 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
virtual void AddPlatformDefinitions(cmMakefile *);
};
#endif

View File

@ -17,6 +17,7 @@
cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator()
{
this->ArchitectureId = "x64";
this->AdditionalPlatformDefinition = "CMAKE_FORCE_WIN64";
}
//----------------------------------------------------------------------------
@ -27,11 +28,3 @@ void cmGlobalVisualStudio9Win64Generator
entry.Brief = "Generates Visual Studio 9 2008 Win64 project files.";
entry.Full = "";
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio9Win64Generator
::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
}

View File

@ -38,11 +38,5 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
virtual void AddPlatformDefinitions(cmMakefile *);
};
#endif

View File

@ -22,6 +22,7 @@
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
{
this->ArchitectureId = "X86";
this->AdditionalPlatformDefinition = NULL;
}
//----------------------------------------------------------------------------
@ -493,6 +494,11 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
{
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
if(this->AdditionalPlatformDefinition)
{
mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE");
}
}
//----------------------------------------------------------------------------

View File

@ -99,6 +99,7 @@ protected:
typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
const char* ArchitectureId;
const char* AdditionalPlatformDefinition;
private:
void ComputeTargetObjects(cmGeneratorTarget* gt) const;