[Cmake-commits] CMake branch, next, updated. v2.8.11.1-2818-g34d0f30
Brad King
brad.king at kitware.com
Fri Jun 28 14:56:08 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 34d0f30ae9d88db81bfa47173c2c1917501884e4 (commit)
via 6c9712c47b99cb5e955f2a72b4093558768a7cc1 (commit)
from e9d5dbf8efbe9199091c14d00b15881f1406531d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34d0f30ae9d88db81bfa47173c2c1917501884e4
commit 34d0f30ae9d88db81bfa47173c2c1917501884e4
Merge: e9d5dbf 6c9712c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 28 14:56:06 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 28 14:56:06 2013 -0400
Merge topic 'vs-windows-forms' into next
6c9712c VS: Add Resx configuration to the vcxproj file
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c9712c47b99cb5e955f2a72b4093558768a7cc1
commit 6c9712c47b99cb5e955f2a72b4093558768a7cc1
Author: Jonas Andersen <jonas at fja.dk>
AuthorDate: Fri Jun 28 09:04:01 2013 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 28 09:23:41 2013 -0400
VS: Add Resx configuration to the vcxproj file
In my project group we are using CMake to generate c++/cli winform
projects and I noticed the work done in commit 79ec7868 (VS: Add Windows
Forms Support, 2013-04-29) was in the right direction for solving some
of the problems we were facing.
The changes as submitted was breaking some functionality in our
projects, so I made some changes that fixes our problems and I believe
that it will also work for others.
* Resx files did not link correctly with the winform h-file so I added
the Resx configuration to the vcxproj file.
* I removed the functionality for setting <CLRSupport> true for the
project based on if an resx-file is pressent. This is preventing
us from using native cpp code. Also this do not address that some
projects will need to set other options like clr:pure, clr:safe.
This could be implemented as a cmake option, so it is possible to
specify exactly what is needed. Existing VSWindowsFormsResx Test
project is updated so it will be working with my changes.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d0ab976..ae92f88 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -300,7 +300,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteAllSources();
this->WriteDotNetReferences();
-
+ this->WriteEmbeddedResourceGroup();
this->WriteWinRTReferences();
this->WriteProjectReferences();
this->WriteString(
@@ -339,6 +339,47 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
+{
+ std::vector<cmSourceFile*> const& resxObjs =
+ this->GeneratorTarget->ResxSources;
+ if(!resxObjs.empty())
+ {
+ this->WriteString("<ItemGroup>\n", 1);
+ for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
+ oi != resxObjs.end(); ++oi)
+ {
+ std::string obj = (*oi)->GetFullPath();
+ this->WriteString("<EmbeddedResource Include=\"", 2);
+ this->ConvertToWindowsSlash(obj);
+ (*this->BuildFileStream ) << obj << "\">\n";
+
+ this->WriteString("<DependentUpon>", 3);
+ std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
+ (*this->BuildFileStream ) << hFileName;
+ this->WriteString("</DependentUpon>\n", 3);
+
+ std::vector<std::string> const * configs =
+ this->GlobalGenerator->GetConfigurations();
+ for(std::vector<std::string>::const_iterator i = configs->begin();
+ i != configs->end(); ++i)
+ {
+ this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
+ if(this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
+ {
+ (*this->BuildFileStream ) << "$(RootNamespace).";
+ }
+ (*this->BuildFileStream ) << "%(Filename)";
+ (*this->BuildFileStream ) << ".resources";
+ (*this->BuildFileStream ) << "</LogicalName>\n";
+ }
+
+ this->WriteString("</EmbeddedResource>\n", 2);
+ }
+ this->WriteString("</ItemGroup>\n", 1);
+ }
+}
+
void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
{
std::vector<std::string> references;
@@ -466,11 +507,6 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
"</WindowsAppContainer>\n", 2);
}
- if(!this->GeneratorTarget->ResxSources.empty())
- {
- this->WriteString("<CLRSupport>true</CLRSupport>\n", 2);
- }
-
this->WriteString("</PropertyGroup>\n", 1);
}
}
@@ -663,11 +699,12 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
}
- std::vector<cmSourceFile*> resxObjs = this->GeneratorTarget->ResxSources;
+ std::vector<cmSourceFile*> const& resxObjs =
+ this->GeneratorTarget->ResxSources;
if(!resxObjs.empty())
{
this->WriteString("<ItemGroup>\n", 1);
- for(std::vector<cmSourceFile*>::iterator oi = resxObjs.begin();
+ for(std::vector<cmSourceFile*>::const_iterator oi = resxObjs.begin();
oi != resxObjs.end(); ++oi)
{
std::string obj = (*oi)->GetFullPath();
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 73d5961..9a480a8 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -59,6 +59,7 @@ private:
void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
void WriteAllSources();
void WriteDotNetReferences();
+ void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
diff --git a/Tests/VSWindowsFormsResx/CMakeLists.txt b/Tests/VSWindowsFormsResx/CMakeLists.txt
index a313ac2..4373810 100644
--- a/Tests/VSWindowsFormsResx/CMakeLists.txt
+++ b/Tests/VSWindowsFormsResx/CMakeLists.txt
@@ -25,6 +25,7 @@ set(TARGET_SRC
WindowsFormsResx/MyForm.cpp
WindowsFormsResx/Source.cpp
)
+set_source_files_properties(${TARGET_SRC} PROPERTIES COMPILE_FLAGS "/clr")
set(TARGET_RESX
WindowsFormsResx/MyForm.resx
-----------------------------------------------------------------------
Summary of changes:
Source/cmVisualStudio10TargetGenerator.cxx | 53 +++++++++++++++++++++++----
Source/cmVisualStudio10TargetGenerator.h | 1 +
Tests/VSWindowsFormsResx/CMakeLists.txt | 1 +
3 files changed, 47 insertions(+), 8 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list