summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-01-04 23:51:15 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-01-05 15:37:14 (GMT)
commit13caaa3eb74a11dbf067409ea129321718d34dfe (patch)
tree82d8b9b3cd5a190cf03e4d6041fd06dd334768f8 /Source
parentc59ed2955294d6b8fe25926c95711f794284354f (diff)
downloadCMake-13caaa3eb74a11dbf067409ea129321718d34dfe.zip
CMake-13caaa3eb74a11dbf067409ea129321718d34dfe.tar.gz
CMake-13caaa3eb74a11dbf067409ea129321718d34dfe.tar.bz2
VS10: Finish Midl support (#11461)
This commit addresses all of the following: http://public.kitware.com/Bug/view.php?id=8165 http://public.kitware.com/Bug/view.php?id=10687 http://public.kitware.com/Bug/view.php?id=11311 http://public.kitware.com/Bug/view.php?id=11461 With this commit, the midl support for VS10 is as complete as midl support ever was for VS9 and earlier. The VSMidl test should run on all Visual Studio generator based dashboards. CMake no longer sends C++ compiler /D flag values to the midl compiler in Visual Studio generated projects. I think if we want to add that in the future, we should add a way to pass midl compiler specific flags and perhaps an optional way to add in the C++ definitions, too. For now, not sending them along gets past the immediate problem wherein idl files in a CMake VS generated project just didn't work at all. The VSMidl test added in this commit was inspired by the patch attached to 8165. The test had to be modified such that it will run in a directory whose name contains no spaces. There is an existing bug filed against VS10's midl asking Microsoft to fix that problem. But for now, the test added in this commit works by copying the source directory to a location that avoids spaces in the directory names. Inspired-By: Robert Lenhardt
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx1
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx26
2 files changed, 23 insertions, 4 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index b22c429..dfaa7a6 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -797,7 +797,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
tool = "VFMIDLTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
- targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n";
if( this->PlatformName == "x64" )
{
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 20ed5a8..8438d16 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -436,6 +436,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceFile*> customBuild;
std::vector<cmSourceFile*> none;
std::vector<cmSourceFile*> headers;
+ std::vector<cmSourceFile*> idls;
std::vector<cmSourceFile*> resource;
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -458,7 +459,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
clCompile.push_back(sf);
}
- if(strcmp(lang, "RC") == 0)
+ else if(strcmp(lang, "RC") == 0)
{
resource.push_back(sf);
}
@@ -470,6 +471,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
headers.push_back(sf);
}
+ else if(sf->GetExtension() == "idl")
+ {
+ idls.push_back(sf);
+ }
else
{
none.push_back(sf);
@@ -498,6 +503,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteGroupSources("ClCompile", clCompile, sourceGroups);
this->WriteGroupSources("ClInclude", headers, sourceGroups);
this->WriteGroupSources("ResourceCompile", resource, sourceGroups);
+ this->WriteGroupSources("Midl", idls, sourceGroups);
this->WriteGroupSources("CustomBuild", customBuild, sourceGroups);
this->WriteString("<ItemGroup>\n", 1);
@@ -670,6 +676,7 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
const char* lang = (*source)->GetLanguage();
bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0);
bool rc = lang && (strcmp(lang, "RC") == 0);
+ bool idl = (*source)->GetExtension() == "idl";
std::string sourceFile = (*source)->GetFullPath();
sourceFile = cmSystemTools::RelativePath(
this->Makefile->GetCurrentOutputDirectory(),
@@ -688,6 +695,10 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
{
this->WriteString("<ResourceCompile Include=\"", 2);
}
+ else if(idl)
+ {
+ this->WriteString("<Midl Include=\"", 2);
+ }
else
{
this->WriteString("<None Include=\"", 2);
@@ -1394,11 +1405,20 @@ WriteMidlOptions(std::string const& /*config*/,
{
this->WriteString("<Midl>\n", 2);
this->OutputIncludes(includes);
+ this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3);
+ this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
+ this->WriteString(
+ "<TypeLibraryName>%(Filename).tlb</TypeLibraryName>\n", 3);
+ this->WriteString(
+ "<InterfaceIdentifierFileName>"
+ "%(Filename)_i.c</InterfaceIdentifierFileName>\n", 3);
+ this->WriteString("<ProxyFileName>%(Filename)_p.c</ProxyFileName>\n",3);
this->WriteString("</Midl>\n", 2);
}
-
+
+
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
-{
+{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();