Browse Source

Ninja Multi-Config: Add variable to control configs used in cross-config build

Kyle Edwards 5 years ago
parent
commit
b7a2baf38c
21 changed files with 455 additions and 14 deletions
  1. 6 0
      Help/generator/Ninja Multi-Config.rst
  2. 1 0
      Help/manual/cmake-variables.7.rst
  3. 7 0
      Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS.rst
  4. 52 10
      Source/cmGlobalNinjaGenerator.cxx
  5. 6 0
      Source/cmGlobalNinjaGenerator.h
  6. 6 4
      Source/cmNinjaNormalTargetGenerator.cxx
  7. 14 0
      Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
  8. 45 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake
  9. 45 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake
  10. 45 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake
  11. 1 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt
  12. 1 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt
  13. 31 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake
  14. 37 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake
  15. 31 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake
  16. 44 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake
  17. 37 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake
  18. 1 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt
  19. 1 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt
  20. 43 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake
  21. 1 0
      Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake

+ 6 - 0
Help/generator/Ninja Multi-Config.rst

@@ -31,6 +31,12 @@ targets will always use the configuration specified in
 Ninja for the same file to be output with different commands in the same build
 Ninja for the same file to be output with different commands in the same build
 graph.
 graph.
 
 
+You can additionally use :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIGS` to limit
+the configurations that get cross-generated. If this variable is set, each
+``build-<Config>.ninja`` file will only contain rules for the configurations
+listed in the variable, plus their own configuration. This also affects which
+configurations are built by the ``<target>:all`` target.
+
 If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is not enabled, you can
 If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is not enabled, you can
 still build any target in ``build-<Config>.ninja`` by specifying
 still build any target in ``build-<Config>.ninja`` by specifying
 ``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or
 ``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or

+ 1 - 0
Help/manual/cmake-variables.7.rst

@@ -424,6 +424,7 @@ Variables that Control the Build
    /variable/CMAKE_MODULE_LINKER_FLAGS_INIT
    /variable/CMAKE_MODULE_LINKER_FLAGS_INIT
    /variable/CMAKE_MSVCIDE_RUN_PATH
    /variable/CMAKE_MSVCIDE_RUN_PATH
    /variable/CMAKE_MSVC_RUNTIME_LIBRARY
    /variable/CMAKE_MSVC_RUNTIME_LIBRARY
+   /variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS
    /variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE
    /variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE
    /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_ALIAS
    /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_ALIAS
    /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE
    /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE

+ 7 - 0
Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS.rst

@@ -0,0 +1,7 @@
+CMAKE_NINJA_MULTI_CROSS_CONFIGS
+-------------------------------
+
+Set which configurations get cross-built if
+:variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is set. See the
+documentation for the :generator:`Ninja Multi-Config` generator for more
+information.

+ 52 - 10
Source/cmGlobalNinjaGenerator.cxx

@@ -1191,8 +1191,7 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
     build.Outputs.front() = ta.first;
     build.Outputs.front() = ta.first;
     build.ExplicitDeps.clear();
     build.ExplicitDeps.clear();
     if (ta.second.Config == "all") {
     if (ta.second.Config == "all") {
-      for (auto const& config :
-           ta.second.GeneratorTarget->Makefile->GetGeneratorConfigs()) {
+      for (auto const& config : this->GetCrossConfigs("")) {
         this->AppendTargetOutputs(ta.second.GeneratorTarget,
         this->AppendTargetOutputs(ta.second.GeneratorTarget,
                                   build.ExplicitDeps, config);
                                   build.ExplicitDeps, config);
       }
       }
@@ -1200,7 +1199,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
       this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps,
       this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps,
                                 ta.second.Config);
                                 ta.second.Config);
     }
     }
-    this->WriteBuild(this->EnableCrossConfigBuild()
+    this->WriteBuild(this->EnableCrossConfigBuild() &&
+                         (ta.second.Config == "all" ||
+                          this->GetCrossConfigs("").count(ta.second.Config))
                        ? os
                        ? os
                        : *this->GetImplFileStream(ta.second.Config),
                        : *this->GetImplFileStream(ta.second.Config),
                      build);
                      build);
@@ -1301,9 +1302,11 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
         }
         }
       }
       }
       // Write target
       // Write target
-      this->WriteBuild(
-        this->EnableCrossConfigBuild() ? os : *this->GetImplFileStream(config),
-        build);
+      this->WriteBuild(this->EnableCrossConfigBuild() &&
+                           this->GetCrossConfigs("").count(config)
+                         ? os
+                         : *this->GetImplFileStream(config),
+                       build);
     }
     }
 
 
     // Add shortcut target
     // Add shortcut target
@@ -1330,7 +1333,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
     // Add target for all configs
     // Add target for all configs
     if (this->EnableCrossConfigBuild()) {
     if (this->EnableCrossConfigBuild()) {
       build.ExplicitDeps.clear();
       build.ExplicitDeps.clear();
-      for (auto const& config : configs) {
+      for (auto const& config : this->GetCrossConfigs("")) {
         build.ExplicitDeps.push_back(this->BuildAlias(
         build.ExplicitDeps.push_back(this->BuildAlias(
           this->ConvertToNinjaPath(currentBinaryDir + "/all"), config));
           this->ConvertToNinjaPath(currentBinaryDir + "/all"), config));
       }
       }
@@ -1785,11 +1788,19 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
       build.ExplicitDeps.clear();
       build.ExplicitDeps.clear();
 
 
       if (additionalFiles) {
       if (additionalFiles) {
-        build.ExplicitDeps.push_back(
-          this->NinjaOutputPath(this->GetAdditionalCleanTargetName()));
+        for (auto const& config : this->GetCrossConfigs("")) {
+          build.ExplicitDeps.push_back(this->BuildAlias(
+            this->NinjaOutputPath(this->GetAdditionalCleanTargetName()),
+            config));
+        }
       }
       }
 
 
-      build.Variables["TARGETS"] = "";
+      std::vector<std::string> byproducts;
+      for (auto const& config : this->GetCrossConfigs("")) {
+        byproducts.push_back(
+          this->BuildAlias(GetByproductsForCleanTargetName(), config));
+      }
+      build.Variables["TARGETS"] = cmJoin(byproducts, " ");
 
 
       for (auto const& fileConfig : configs) {
       for (auto const& fileConfig : configs) {
         build.Variables["FILE_ARG"] = cmStrCat(
         build.Variables["FILE_ARG"] = cmStrCat(
@@ -2359,6 +2370,15 @@ void cmGlobalNinjaGenerator::AppendDirectoryForConfig(
   }
   }
 }
 }
 
 
+std::set<std::string> cmGlobalNinjaGenerator::GetCrossConfigs(
+  const std::string& /*fileConfig*/) const
+{
+  std::set<std::string> result;
+  result.insert(
+    this->Makefiles.front()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
+  return result;
+}
+
 const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE =
 const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE =
   "CMakeFiles/common.ninja";
   "CMakeFiles/common.ninja";
 const char* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja";
 const char* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja";
@@ -2525,3 +2545,25 @@ const char* cmGlobalNinjaMultiGenerator::GetDefaultBuildAlias() const
 
 
   return this->GetDefaultBuildType();
   return this->GetDefaultBuildType();
 }
 }
+
+std::set<std::string> cmGlobalNinjaMultiGenerator::GetCrossConfigs(
+  const std::string& fileConfig) const
+{
+  std::vector<std::string> configs;
+  if (this->EnableCrossConfigBuild()) {
+    auto configsValue = this->Makefiles.front()->GetSafeDefinition(
+      "CMAKE_NINJA_MULTI_CROSS_CONFIGS");
+    if (!configsValue.empty()) {
+      cmExpandList(configsValue, configs);
+    } else {
+      configs = this->Makefiles.front()->GetGeneratorConfigs();
+    }
+  }
+
+  std::set<std::string> result(configs.cbegin(), configs.cend());
+  if (!fileConfig.empty()) {
+    result.insert(fileConfig);
+  }
+
+  return result;
+}

+ 6 - 0
Source/cmGlobalNinjaGenerator.h

@@ -412,6 +412,9 @@ public:
 
 
   virtual const char* GetDefaultBuildAlias() const { return nullptr; }
   virtual const char* GetDefaultBuildAlias() const { return nullptr; }
 
 
+  virtual std::set<std::string> GetCrossConfigs(
+    const std::string& fileConfig) const;
+
 protected:
 protected:
   void Generate() override;
   void Generate() override;
 
 
@@ -623,6 +626,9 @@ public:
 
 
   const char* GetDefaultBuildAlias() const override;
   const char* GetDefaultBuildAlias() const override;
 
 
+  std::set<std::string> GetCrossConfigs(
+    const std::string& fileConfig) const override;
+
 protected:
 protected:
   bool OpenBuildFileStreams() override;
   bool OpenBuildFileStreams() override;
   void CloseBuildFileStreams() override;
   void CloseBuildFileStreams() override;

+ 6 - 4
Source/cmNinjaNormalTargetGenerator.cxx

@@ -72,8 +72,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config)
   // Write the build statements
   // Write the build statements
   bool firstForConfig = true;
   bool firstForConfig = true;
   for (auto const& fileConfig : this->GetConfigNames()) {
   for (auto const& fileConfig : this->GetConfigNames()) {
-    if (fileConfig != config &&
-        !this->GetGlobalGenerator()->EnableCrossConfigBuild()) {
+    if (!this->GetGlobalGenerator()
+           ->GetCrossConfigs(fileConfig)
+           .count(config)) {
       continue;
       continue;
     }
     }
     this->WriteObjectBuildStatements(config, fileConfig, firstForConfig);
     this->WriteObjectBuildStatements(config, fileConfig, firstForConfig);
@@ -85,8 +86,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config)
   } else {
   } else {
     firstForConfig = true;
     firstForConfig = true;
     for (auto const& fileConfig : this->GetConfigNames()) {
     for (auto const& fileConfig : this->GetConfigNames()) {
-      if (fileConfig != config &&
-          !this->GetGlobalGenerator()->EnableCrossConfigBuild()) {
+      if (!this->GetGlobalGenerator()
+             ->GetCrossConfigs(fileConfig)
+             .count(config)) {
         continue;
         continue;
       }
       }
       // If this target has cuda language link inputs, and we need to do
       // If this target has cuda language link inputs, and we need to do

+ 14 - 0
Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake

@@ -128,6 +128,20 @@ run_ninja(SimpleNoCross all-target build-Debug.ninja simplestatic:all)
 run_ninja(SimpleNoCross all-all build-Debug.ninja all:all)
 run_ninja(SimpleNoCross all-all build-Debug.ninja all:all)
 run_cmake_build(SimpleNoCross all-clean Debug clean:all)
 run_cmake_build(SimpleNoCross all-clean Debug clean:all)
 
 
+set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleCrossConfigs-build)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON;-DCMAKE_NINJA_MULTI_CROSS_CONFIGS=Debug\\;Release")
+run_cmake_configure(SimpleCrossConfigs)
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+run_ninja(SimpleCrossConfigs release-in-release-graph build-Release.ninja simpleexe)
+run_cmake_build(SimpleCrossConfigs debug-in-release-graph Release simpleexe:Debug)
+run_cmake_build(SimpleCrossConfigs relwithdebinfo-in-release-graph Release simpleexe:RelWithDebInfo)
+run_ninja(SimpleCrossConfigs relwithdebinfo-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simpleexe:RelWithDebInfo)
+run_ninja(SimpleCrossConfigs release-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simplestatic:Release)
+run_cmake_build(SimpleCrossConfigs all-in-relwithdebinfo-graph RelWithDebInfo simplestatic:all)
+run_ninja(SimpleCrossConfigs clean-all-in-release-graph build-Release.ninja clean:all)
+run_cmake_build(SimpleCrossConfigs all-all-in-release-graph Release all:all)
+run_cmake_build(SimpleCrossConfigs all-relwithdebinfo-in-release-graph Release all:RelWithDebInfo)
+
 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build)
 set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build)
 set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
 set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON")
 run_cmake_configure(CustomCommandGenerator)
 run_cmake_configure(CustomCommandGenerator)

+ 45 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake

@@ -0,0 +1,45 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_FILE_simplestatic_Debug}
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_FILE_simplestatic_Release}
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 45 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake

@@ -0,0 +1,45 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_FILE_simplestatic_Debug}
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_FILE_simplestatic_Release}
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 45 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake

@@ -0,0 +1,45 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_FILE_simplestatic_Debug}
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_FILE_simplestatic_Release}
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt

@@ -0,0 +1 @@
+1

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt

@@ -0,0 +1 @@
+^ninja: error: unknown target 'all:RelWithDebInfo'$

+ 31 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake

@@ -0,0 +1,31 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 37 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake

@@ -0,0 +1,37 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+  )

+ 31 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake

@@ -0,0 +1,31 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+  )

+ 44 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake

@@ -0,0 +1,44 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_FILE_simplestatic_Release}
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 37 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake

@@ -0,0 +1,37 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+  )

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt

@@ -0,0 +1 @@
+1

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt

@@ -0,0 +1 @@
+^ninja: error: unknown target 'simpleexe:RelWithDebInfo'$

+ 43 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake

@@ -0,0 +1,43 @@
+check_files("${RunCMake_TEST_BINARY_DIR}"
+  INCLUDE
+    ${GENERATED_FILES}
+
+    ${TARGET_FILE_simpleexe_Debug}
+    ${TARGET_OBJECT_FILES_simpleexe_Debug}
+
+    ${TARGET_FILE_simpleshared_Debug}
+    ${TARGET_LINKER_FILE_simpleshared_Debug}
+    ${TARGET_OBJECT_FILES_simpleshared_Debug}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Debug}
+
+    ${TARGET_FILE_simpleexe_Release}
+    ${TARGET_OBJECT_FILES_simpleexe_Release}
+
+    ${TARGET_FILE_simpleshared_Release}
+    ${TARGET_LINKER_FILE_simpleshared_Release}
+    ${TARGET_OBJECT_FILES_simpleshared_Release}
+
+    ${TARGET_OBJECT_FILES_simpleobj_Release}
+
+    ${TARGET_FILE_simpleexe_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo}
+
+    ${TARGET_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo}
+    ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo}
+
+    ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo}
+
+  EXCLUDE
+    ${TARGET_OBJECT_FILES_simplestatic_Debug}
+
+    ${TARGET_OBJECT_FILES_simplestatic_Release}
+
+    ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel}
+    ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel}
+
+    ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo}
+  )

+ 1 - 0
Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake

@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake")