Browse Source

cmQtAutoGenInitializer: Define CrossConfig variable

Orkun Tokdemir 2 years ago
parent
commit
cac2e029f0
2 changed files with 6 additions and 5 deletions
  1. 5 5
      Source/cmQtAutoGenInitializer.cxx
  2. 1 0
      Source/cmQtAutoGenInitializer.h

+ 5 - 5
Source/cmQtAutoGenInitializer.cxx

@@ -332,6 +332,8 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
   this->Uic.Enabled = uicEnabled;
   this->Uic.Enabled = uicEnabled;
   this->Rcc.Enabled = rccEnabled;
   this->Rcc.Enabled = rccEnabled;
   this->Rcc.GlobalTarget = globalAutoRccTarget;
   this->Rcc.GlobalTarget = globalAutoRccTarget;
+  this->CrossConfig =
+    !this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty();
 }
 }
 
 
 bool cmQtAutoGenInitializer::InitCustomTargets()
 bool cmQtAutoGenInitializer::InitCustomTargets()
@@ -1026,8 +1028,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   if (this->MocOrUicEnabled() && !this->AutogenTarget.FilesGenerated.empty()) {
   if (this->MocOrUicEnabled() && !this->AutogenTarget.FilesGenerated.empty()) {
     if (this->CMP0071Accept) {
     if (this->CMP0071Accept) {
       // Let the autogen target depend on the GENERATED files
       // Let the autogen target depend on the GENERATED files
-      if (this->MultiConfig &&
-          this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty()) {
+      if (this->MultiConfig && !this->CrossConfig) {
         for (MUFile const* muf : this->AutogenTarget.FilesGenerated) {
         for (MUFile const* muf : this->AutogenTarget.FilesGenerated) {
           if (muf->Configs.empty()) {
           if (muf->Configs.empty()) {
             this->AutogenTarget.DependFiles.insert(muf->FullPath);
             this->AutogenTarget.DependFiles.insert(muf->FullPath);
@@ -1190,8 +1191,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
   if (this->Moc.Enabled) {
   if (this->Moc.Enabled) {
     this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
     this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
     if (useDepfile) {
     if (useDepfile) {
-      if (this->MultiConfig &&
-          !this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty() &&
+      if (this->MultiConfig && this->CrossConfig &&
           this->GlobalGen->GetName().find("Ninja") != std::string::npos) {
           this->GlobalGen->GetName().find("Ninja") != std::string::npos) {
         // Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
         // Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
         // ${target}_autogen/timestamp custom command.
         // ${target}_autogen/timestamp custom command.
@@ -1239,7 +1239,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
   this->GlobalGen->GetQtAutoGenConfigs(configs);
   this->GlobalGen->GetQtAutoGenConfigs(configs);
   bool constexpr stdPipesUTF8 = true;
   bool constexpr stdPipesUTF8 = true;
   cmCustomCommandLines commandLines;
   cmCustomCommandLines commandLines;
-  if (this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty()) {
+  if (!this->CrossConfig) {
     std::string autogenInfoFileConfig;
     std::string autogenInfoFileConfig;
     if (this->MultiConfig) {
     if (this->MultiConfig) {
       autogenInfoFileConfig = "$<CONFIG>";
       autogenInfoFileConfig = "$<CONFIG>";

+ 1 - 0
Source/cmQtAutoGenInitializer.h

@@ -167,6 +167,7 @@ private:
   IntegerVersion QtVersion;
   IntegerVersion QtVersion;
   unsigned int Verbosity = 0;
   unsigned int Verbosity = 0;
   bool MultiConfig = false;
   bool MultiConfig = false;
+  bool CrossConfig = false;
   bool CMP0071Accept = false;
   bool CMP0071Accept = false;
   bool CMP0071Warn = false;
   bool CMP0071Warn = false;
   bool CMP0100Accept = false;
   bool CMP0100Accept = false;