[Cmake-commits] [cmake-commits] david.cole committed cmBuildCommand.cxx 1.25 1.26 cmBuildCommand.h 1.14 1.15 cmGlobalGenerator.h 1.128 1.129 cmGlobalVisualStudioGenerator.h 1.15 1.16 cmGlobalXCodeGenerator.cxx 1.240 1.241 cmGlobalXCodeGenerator.h 1.65 1.66
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Dec 4 12:08:59 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26529/Source
Modified Files:
cmBuildCommand.cxx cmBuildCommand.h cmGlobalGenerator.h
cmGlobalVisualStudioGenerator.h cmGlobalXCodeGenerator.cxx
cmGlobalXCodeGenerator.h
Log Message:
Fix issue #2336 - honor the -C arg to ctest. Honor it for all stages of running -D dashboards from the command line and running ctest_configure, ctest_build and ctest_test commands in -S scripts. Also, allow a script to change it by setting the CTEST_CONFIGURATION_TYPE variable: allows for multiple configuration build/test cycles within one script. Add a new signature for the cmake command build_command that accepts CONFIGURATION as one argument. The original build_command signature is still there, but now marked as deprecated in the documentation. Of course... also add CTestConfig tests to verify that -C is honored for -D dashboards and -S scripts.
Index: cmGlobalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -C 2 -d -r1.65 -r1.66
*** cmGlobalXCodeGenerator.h 28 Sep 2009 15:42:42 -0000 1.65
--- cmGlobalXCodeGenerator.h 4 Dec 2009 17:08:56 -0000 1.66
***************
*** 81,84 ****
--- 81,89 ----
dirs);
void SetCurrentLocalGenerator(cmLocalGenerator*);
+
+ /** Return true if the generated build tree may contain multiple builds.
+ i.e. "Can I build Debug and Release in the same tree?" */
+ virtual bool IsMultiConfig();
+
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.240
retrieving revision 1.241
diff -C 2 -d -r1.240 -r1.241
*** cmGlobalXCodeGenerator.cxx 6 Nov 2009 13:04:19 -0000 1.240
--- cmGlobalXCodeGenerator.cxx 4 Dec 2009 17:08:55 -0000 1.241
***************
*** 3303,3304 ****
--- 3303,3319 ----
return plist;
}
+
+ //----------------------------------------------------------------------------
+ // Return true if the generated build tree may contain multiple builds.
+ // i.e. "Can I build Debug and Release in the same tree?"
+ bool cmGlobalXCodeGenerator::IsMultiConfig()
+ {
+ // Old Xcode 1.5 is single config:
+ if(this->XcodeVersion == 15)
+ {
+ return false;
+ }
+
+ // Newer Xcode versions are multi config:
+ return true;
+ }
Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.128
retrieving revision 1.129
diff -C 2 -d -r1.128 -r1.129
*** cmGlobalGenerator.h 6 Oct 2009 17:29:59 -0000 1.128
--- cmGlobalGenerator.h 4 Dec 2009 17:08:55 -0000 1.129
***************
*** 259,262 ****
--- 259,266 ----
virtual void CreateGUID(const char*) {}
+ /** Return true if the generated build tree may contain multiple builds.
+ i.e. "Can I build Debug and Release in the same tree?" */
+ virtual bool IsMultiConfig() { return false; }
+
protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
Index: cmBuildCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmBuildCommand.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -C 2 -d -r1.25 -r1.26
*** cmBuildCommand.cxx 28 Sep 2009 15:41:57 -0000 1.25
--- cmBuildCommand.cxx 4 Dec 2009 17:08:55 -0000 1.26
***************
*** 15,31 ****
#include "cmGlobalGenerator.h"
! // cmBuildCommand
bool cmBuildCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() < 2 )
{
! this->SetError("called with incorrect number of arguments");
return false;
}
const char* define = args[0].c_str();
const char* cacheValue
= this->Makefile->GetDefinition(define);
std::string makeprogram = args[1];
std::string configType = "Release";
const char* cfg = getenv("CMAKE_CONFIG_TYPE");
--- 15,140 ----
#include "cmGlobalGenerator.h"
! //----------------------------------------------------------------------
bool cmBuildCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
+ // Support the legacy signature of the command:
+ //
+ if(2 == args.size())
+ {
+ return this->TwoArgsSignature(args);
+ }
+
+ return this->MainSignature(args);
+ }
+
+ //----------------------------------------------------------------------
+ bool cmBuildCommand
+ ::MainSignature(std::vector<std::string> const& args)
+ {
+ if(args.size() < 1)
+ {
+ this->SetError("requires at least one argument naming a CMake variable");
+ return false;
+ }
+
+ // The cmake variable in which to store the result.
+ const char* variable = args[0].c_str();
+
+ // Parse remaining arguments.
+ const char* configuration = 0;
+ const char* project_name = 0;
+ const char* target = 0;
+ enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget };
+ Doing doing = DoingNone;
+ for(unsigned int i=1; i < args.size(); ++i)
+ {
+ if(args[i] == "CONFIGURATION")
+ {
+ doing = DoingConfiguration;
+ }
+ else if(args[i] == "PROJECT_NAME")
+ {
+ doing = DoingProjectName;
+ }
+ else if(args[i] == "TARGET")
+ {
+ doing = DoingTarget;
+ }
+ else if(doing == DoingConfiguration)
+ {
+ doing = DoingNone;
+ configuration = args[i].c_str();
+ }
+ else if(doing == DoingProjectName)
+ {
+ doing = DoingNone;
+ project_name = args[i].c_str();
+ }
+ else if(doing == DoingTarget)
+ {
+ doing = DoingNone;
+ target = args[i].c_str();
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "unknown argument \"" << args[i] << "\"";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+
+ const char* makeprogram
+ = this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
+
+ // If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug'
+ // in the currently implemented multi-configuration global generators...
+ // so we put this code here to end up with the same default configuration
+ // as the original 2-arg build_command signature:
+ //
+ if(!configuration || !*configuration)
+ {
+ configuration = getenv("CMAKE_CONFIG_TYPE");
+ }
+ if(!configuration || !*configuration)
+ {
+ configuration = "Release";
+ }
+
+ // If null/empty PROJECT_NAME argument, use the Makefile's project name:
+ //
+ if(!project_name || !*project_name)
+ {
+ project_name = this->Makefile->GetProjectName();
+ }
+
+ // If null/empty TARGET argument, GenerateBuildCommand omits any mention
+ // of a target name on the build command line...
+ //
+ std::string makecommand = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->GenerateBuildCommand
+ (makeprogram, project_name, 0, target, configuration, true, false);
+
+ this->Makefile->AddDefinition(variable, makecommand.c_str());
+
+ return true;
+ }
+
+ //----------------------------------------------------------------------
+ bool cmBuildCommand
+ ::TwoArgsSignature(std::vector<std::string> const& args)
+ {
if(args.size() < 2 )
{
! this->SetError("called with less than two arguments");
return false;
}
+
const char* define = args[0].c_str();
const char* cacheValue
= this->Makefile->GetDefinition(define);
std::string makeprogram = args[1];
+
std::string configType = "Release";
const char* cfg = getenv("CMAKE_CONFIG_TYPE");
***************
*** 34,37 ****
--- 143,147 ----
configType = cfg;
}
+
std::string makecommand = this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->GenerateBuildCommand
***************
*** 50,52 ****
return true;
}
-
--- 160,161 ----
Index: cmGlobalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmGlobalVisualStudioGenerator.h 20 Oct 2009 20:38:37 -0000 1.15
--- cmGlobalVisualStudioGenerator.h 4 Dec 2009 17:08:55 -0000 1.16
***************
*** 66,69 ****
--- 66,74 ----
/** Get the top-level registry key for this VS version. */
std::string GetRegistryBase();
+
+ /** Return true if the generated build tree may contain multiple builds.
+ i.e. "Can I build Debug and Release in the same tree?" */
+ virtual bool IsMultiConfig() { return true; }
+
protected:
void FixUtilityDepends();
Index: cmBuildCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmBuildCommand.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C 2 -d -r1.14 -r1.15
*** cmBuildCommand.h 28 Sep 2009 15:41:57 -0000 1.14
--- cmBuildCommand.h 4 Dec 2009 17:08:55 -0000 1.15
***************
*** 39,46 ****
/**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() {return "build_command";}
!
/**
* Succinct documentation.
--- 39,56 ----
/**
+ * The primary command signature with optional, KEYWORD-based args.
+ */
+ virtual bool MainSignature(std::vector<std::string> const& args);
+
+ /**
+ * Legacy "exactly 2 args required" signature.
+ */
+ virtual bool TwoArgsSignature(std::vector<std::string> const& args);
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() {return "build_command";}
!
/**
* Succinct documentation.
***************
*** 48,54 ****
virtual const char* GetTerseDocumentation()
{
! return "Get the command line that will build this project.";
}
!
/**
* More documentation.
--- 58,64 ----
virtual const char* GetTerseDocumentation()
{
! return "Get the command line to build this project.";
}
!
/**
* More documentation.
***************
*** 57,72 ****
{
return
! " build_command(<variable> <makecommand>)\n"
! "Sets the given <variable> to a string containing the command that "
! "will build this project from the root of the build tree using the "
! "build tool given by <makecommand>. <makecommand> should be msdev, "
! "nmake, make or one of the end user build tools. "
! "This is useful for configuring testing systems.";
}
!
cmTypeMacro(cmBuildCommand, cmCommand);
};
-
-
#endif
--- 67,97 ----
{
return
! " build_command(<variable>\n"
! " [CONFIGURATION <config>]\n"
! " [PROJECT_NAME <projname>]\n"
! " [TARGET <target>])\n"
! "Sets the given <variable> to a string containing the command line "
! "for building one configuration of a target in a project using the "
! "build tool appropriate for the current CMAKE_GENERATOR.\n"
! "If CONFIGURATION is omitted, CMake chooses a reasonable default "
! "value for multi-configuration generators. CONFIGURATION is "
! "ignored for single-configuration generators.\n"
! "If PROJECT_NAME is omitted, the resulting command line will build "
! "the top level PROJECT in the current build tree.\n"
! "If TARGET is omitted, the resulting command line will build "
! "everything, effectively using build target 'all' or 'ALL_BUILD'.\n"
! " build_command(<cachevariable> <makecommand>)\n"
! "This second signature is deprecated, but still available for "
! "backwards compatibility. Use the first signature instead.\n"
! "Sets the given <cachevariable> to a string containing the command "
! "to build this project from the root of the build tree using "
! "the build tool given by <makecommand>. <makecommand> should be "
! "the full path to msdev, devenv, nmake, make or one of the end "
! "user build tools."
! ;
}
!
cmTypeMacro(cmBuildCommand, cmCommand);
};
#endif
More information about the Cmake-commits
mailing list