[CMake] Visual Studio 2012 Beta: unable to compile individual files

Brad King brad.king at kitware.com
Tue Jun 12 16:34:36 EDT 2012


On 06/12/2012 02:20 PM, Ben Medina wrote:
> - Using the VS2010 generator, the project files have relative paths.
> VS2012RC can load 2010 project files without modifying them. If I do
> this, compilation of individual files is successful.
> 
> - Using the VS11 generator, the project files have absolute paths, and
> compilation of individual files fails.
> 
> So can the same relative path workaround be done for the VS11 generator?

The patch below achieves this.  More work will be needed to update
associated comments and warning message generation, so this is not
ready yet.  I'd like to wait to see the response to your report
before spending more time on the workaround.  Hopefully it will
simply be fixed for the final release.

-Brad


diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9a97ab0..9db7042 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -759,7 +759,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(
   // conversion uses full paths outside the build tree to allow deeper trees.
   bool forceRelative = false;
   std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false);
-  if(this->LocalGenerator->GetVersion() == cmLocalVisualStudioGenerator::VS10
+  if(this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS10
      && cmSystemTools::FileIsFullPath(sourceFile.c_str()))
     {
     // Normal path conversion resulted in a full path.  VS 10 (but not 11)


More information about the CMake mailing list