From 8cd66dc0d275208367dd6b5ef266395ef92ed424 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 21 Jun 2011 15:58:11 -0400 Subject: [PATCH 1/4] Use devenv instead of msbuild for vs2010. --- Modules/CMakeVS10FindMake.cmake | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake index af5f3a7d5..388203cab 100644 --- a/Modules/CMakeVS10FindMake.cmake +++ b/Modules/CMakeVS10FindMake.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2009 Kitware, Inc. +# Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,17 +12,28 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# We use MSBuild as the build tool for VS 10 -FIND_PROGRAM(CMAKE_MAKE_PROGRAM - NAMES MSBuild - HINTS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir] - "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" - "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" - "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/" - ) +# VCExpress does not support cross compiling, which is necessary for Win CE +SET( _CMAKE_MAKE_PROGRAM_NAMES devenv) +IF(NOT CMAKE_CROSSCOMPILING) + SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) +ENDIF(NOT CMAKE_CROSSCOMPILING) +FIND_PROGRAM(CMAKE_MAKE_PROGRAM + NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} + HINTS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path] + "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE" + "/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/" + "/Program Files/Microsoft Visual Studio 10/Common7/IDE/" + ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC10 1) SET(MSVC_VERSION 1600) - From 38368d52f34086294f4647b97a7111fa2547905a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 21 Jun 2011 16:00:31 -0400 Subject: [PATCH 2/4] Revert "With very long file names, VS 2010 was unable to compile files." This reverts commit 945f2c2214bc80f513ed08ebe2c8003263a4ee56. --- Source/cmVisualStudio10TargetGenerator.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6d2338e47..d15099a69 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -367,7 +367,10 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, static_cast (this->GlobalGenerator)->GetConfigurations(); this->WriteString("Makefile->GetCurrentOutputDirectory(), + sourcePath.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream ) << path << "\">\n"; for(std::vector::iterator i = configs->begin(); @@ -608,6 +611,9 @@ WriteGroupSources(const char* name, const char* filter = sourceGroup.GetFullName(); this->WriteString("<", 2); std::string path = source; + path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + source.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << path; @@ -695,6 +701,9 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() bool rc = lang && (strcmp(lang, "RC") == 0); bool idl = ext == "idl"; std::string sourceFile = (*source)->GetFullPath(); + sourceFile = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + sourceFile.c_str()); this->ConvertToWindowsSlash(sourceFile); // output the source file if(header) From ed0075bdb768f8272c2a9fc48e37bf9897427258 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 22 Jun 2011 11:52:15 -0400 Subject: [PATCH 3/4] Use relative paths for custom command inputs. For source files we use full paths. This allows for longer directory names with VS2010. However, the use of full paths causes the GUI to not display the custom commands. --- Source/cmVisualStudio10TargetGenerator.cxx | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d15099a69..facb551fc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -367,10 +367,11 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, static_cast (this->GlobalGenerator)->GetConfigurations(); this->WriteString("Makefile->GetCurrentOutputDirectory(), - sourcePath.c_str()); + // custom command have to use relative paths or they do not + // show up in the GUI + std::string path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + sourcePath.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream ) << path << "\">\n"; for(std::vector::iterator i = configs->begin(); @@ -611,9 +612,14 @@ WriteGroupSources(const char* name, const char* filter = sourceGroup.GetFullName(); this->WriteString("<", 2); std::string path = source; - path = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - source.c_str()); + // custom command sources must use relative paths or they will + // not show up in the GUI. + if(sf->GetCustomCommand()) + { + path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + source.c_str()); + } this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << path; @@ -701,9 +707,8 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() bool rc = lang && (strcmp(lang, "RC") == 0); bool idl = ext == "idl"; std::string sourceFile = (*source)->GetFullPath(); - sourceFile = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourceFile.c_str()); + // do not use a relative path here because it means that you + // can not use as long a path to the file. this->ConvertToWindowsSlash(sourceFile); // output the source file if(header) From 8555c2b4b768037a37705ef7f2486149ae3cdc13 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 23 Jun 2011 15:29:25 -0400 Subject: [PATCH 4/4] Look for VCExpress as a possible build tool as well as devenv. --- Source/cmGlobalVisualStudio10Generator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6c3c1eded..328a3da63 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -123,7 +123,8 @@ std::string cmGlobalVisualStudio10Generator cmSystemTools::LowerCase(lowerCaseCommand); // If makeProgram is devenv, parent class knows how to generate command: - if (lowerCaseCommand.find("devenv") != std::string::npos) + if (lowerCaseCommand.find("devenv") != std::string::npos || + lowerCaseCommand.find("VCExpress") != std::string::npos) { return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram, projectName, additionalOptions, targetName, config, ignoreErrors, fast);