Browse Source

cmGlobalGenerator: Add method to check if object file location is known

Add a `HasKnownObjectFileLocation` method returning whether we know the
exact location of object files produced by the native build system.
This is true everywhere except on Xcode when an architecture placeholder
is used.
Brad King 8 years ago
parent
commit
25f3f22a1a
3 changed files with 19 additions and 0 deletions
  1. 5 0
      Source/cmGlobalGenerator.h
  2. 12 0
      Source/cmGlobalXCodeGenerator.cxx
  3. 2 0
      Source/cmGlobalXCodeGenerator.h

+ 5 - 0
Source/cmGlobalGenerator.h

@@ -331,6 +331,11 @@ public:
       i.e. "Can I build Debug and Release in the same tree?" */
       i.e. "Can I build Debug and Release in the same tree?" */
   virtual bool IsMultiConfig() const { return false; }
   virtual bool IsMultiConfig() const { return false; }
 
 
+  /** Return true if we know the exact location of object files.
+      If false, store the reason in the given string.
+      This is meaningful only after EnableLanguage has been called.  */
+  virtual bool HasKnownObjectFileLocation(std::string*) const { return true; }
+
   virtual bool UseFolderProperty() const;
   virtual bool UseFolderProperty() const;
 
 
   virtual bool IsIPOSupported() const { return false; }
   virtual bool IsIPOSupported() const { return false; }

+ 12 - 0
Source/cmGlobalXCodeGenerator.cxx

@@ -3720,6 +3720,18 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() const
   return true;
   return true;
 }
 }
 
 
+bool cmGlobalXCodeGenerator::HasKnownObjectFileLocation(
+  std::string* reason) const
+{
+  if (this->ObjectDirArch.find('$') != std::string::npos) {
+    if (reason != CM_NULLPTR) {
+      *reason = " under Xcode with multiple architectures";
+    }
+    return false;
+  }
+  return true;
+}
+
 bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
 bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
 {
 {
   const char* epnValue =
   const char* epnValue =

+ 2 - 0
Source/cmGlobalXCodeGenerator.h

@@ -87,6 +87,8 @@ public:
       i.e. "Can I build Debug and Release in the same tree?" */
       i.e. "Can I build Debug and Release in the same tree?" */
   bool IsMultiConfig() const CM_OVERRIDE;
   bool IsMultiConfig() const CM_OVERRIDE;
 
 
+  bool HasKnownObjectFileLocation(std::string* reason) const CM_OVERRIDE;
+
   bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
   bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
 
 
   bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;
   bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;