diff options
45 files changed, 219 insertions, 116 deletions
diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index 96f0486..a844cbf 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -183,7 +183,7 @@ last few lines of the top-level ``CMakeLists.txt`` file should now look like: ) Now let us make the MathFunctions library optional. While for the tutorial -there really isn’t any need to do so, for larger projects this is a common +there really isn't any need to do so, for larger projects this is a common occurrence. The first step is to add an option to the top-level ``CMakeLists.txt`` file. @@ -918,8 +918,8 @@ subbdirectories. The layout will look like: .. code-block:: none - Step12 - └── debug - └── release + - debug + - release Now we need to setup debug and release builds. We can use :variable:`CMAKE_BUILD_TYPE` to set the configuration type: diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 848934c..ba242ec 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -29,6 +29,11 @@ endif() if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":") + + if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") + set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP ":") + endif() endif() set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ") diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 5cc9328..f65916f 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -101,7 +101,7 @@ else() if (NOT CMAKE_GENERATOR MATCHES "Xcode") set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") endif() - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>) set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>) endmacro() endif() diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index a786fb9..1f4d54d 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -82,7 +82,7 @@ set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0) set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0) if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0") - set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ") + set(CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG "--options-file ") set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ") endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c69a2ee..5bac0d8 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1096,7 +1096,7 @@ function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git list(APPEND git_clone_options --progress) endif() foreach(config IN LISTS git_config) - list(APPEND git_clone_options --config ${config}) + list(APPEND git_clone_options --config \"${config}\") endforeach() if(NOT ${git_remote_name} STREQUAL "origin") list(APPEND git_clone_options --origin \"${git_remote_name}\") diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index bd69819..27ffa13 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -10,7 +10,7 @@ Find the OpenGL Extension Wrangler Library (GLEW) Input Variables ^^^^^^^^^^^^^^^ -The following variables may be set to influence this module’s behavior: +The following variables may be set to influence this module's behavior: ``GLEW_USE_STATIC_LIBS`` to find and create :prop_tgt:`IMPORTED` target for static linkage. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index f4b6ea1..c79f20f 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -20,6 +20,10 @@ following variables will also be set: #]========================================] +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced +cmake_policy(SET CMP0057 NEW) # if IN_LIST + ### Common stuff #### set(PKG_CONFIG_VERSION 1) @@ -770,3 +774,5 @@ Variables Affecting Behavior ### Local Variables: ### mode: cmake ### End: + +cmake_policy(POP) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 7fd5e49..dc8dd6f 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -86,7 +86,7 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_PCH_EXTENSION .pch) set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>) set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>) unset(__ADDED_FLAGS) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 370b56e..0c24739 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -122,7 +122,7 @@ macro(__embarcadero_language lang) # Precompile Headers if (EMBARCADERO) set(CMAKE_PCH_EXTENSION .pch) - set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE> -Xclang -include -Xclang <PCH_HEADER>) set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>) endif() diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index b1fc893..2d55a5a 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -29,7 +29,7 @@ bool cmAddDependenciesCommand(std::vector<std::string> const& args, // skip over target_name for (std::string const& arg : cmMakeRange(args).advance(1)) { - target->AddUtility(arg, &mf); + target->AddUtility(arg, false, &mf); } } else { mf.IssueMessage( diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index af257ee..81cd878 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -123,7 +123,7 @@ void cmComputeComponentGraph::TransferEdges() // We do not attempt to combine duplicate edges, but instead // store the inter-component edges with suitable multiplicity. this->ComponentGraph[i_component].emplace_back( - j_component, ni.IsStrong(), ni.GetBacktrace()); + j_component, ni.IsStrong(), ni.IsCross(), ni.GetBacktrace()); } } } diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index ccef9c8..e9bf5a5 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -412,7 +412,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) // This shared library dependency must follow the item that listed // it. this->EntryConstraintGraph[dep.DependerIndex].emplace_back( - index, true, cmListFileBacktrace()); + index, true, false, cmListFileBacktrace()); // Target items may have their own dependencies. if (entry.Target) { @@ -514,7 +514,7 @@ void cmComputeLinkDepends::AddLinkEntries(int depender_index, // The dependee must come after the depender. if (depender_index >= 0) { this->EntryConstraintGraph[depender_index].emplace_back( - dependee_index, false, cmListFileBacktrace()); + dependee_index, false, false, cmListFileBacktrace()); } else { // This is a direct dependency of the target being linked. this->OriginalEntries.push_back(dependee_index); @@ -587,7 +587,7 @@ void cmComputeLinkDepends::InferDependencies() cmGraphEdgeList& edges = this->EntryConstraintGraph[depender_index]; edges.reserve(edges.size() + common.size()); for (auto const& c : common) { - edges.emplace_back(c, true, cmListFileBacktrace()); + edges.emplace_back(c, true, false, cmListFileBacktrace()); } } } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 58ec53a..a98a608 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -151,6 +151,7 @@ void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t, cmGeneratorTarget const* dep = this->Targets[ni]; auto di = deps.insert(dep).first; di->SetType(ni.IsStrong()); + di->SetCross(ni.IsCross()); di->SetBacktrace(ni.GetBacktrace()); } } @@ -217,7 +218,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) return; } const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility( - objLib); + objLib, false); } } } @@ -225,11 +226,12 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) cmLinkImplementation const* impl = depender->GetLinkImplementation(it); // A target should not depend on itself. - emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, false, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace())); for (cmLinkImplItem const& lib : impl->Libraries) { // Don't emit the same library twice for this target. if (emitted.insert(lib).second) { - this->AddTargetDepend(depender_index, lib, true); + this->AddTargetDepend(depender_index, lib, true, false); this->AddInterfaceDepends(depender_index, lib, it, emitted); } } @@ -241,11 +243,12 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); std::set<cmLinkItem> emitted; // A target should not depend on itself. - emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, false, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace())); for (cmLinkItem const& litem : tutils) { // Don't emit the same utility twice for this target. if (emitted.insert(litem).second) { - this->AddTargetDepend(depender_index, litem, false); + this->AddTargetDepend(depender_index, litem, false, litem.Cross); } } } @@ -267,7 +270,7 @@ void cmComputeTargetDepends::AddInterfaceDepends( // code in the project that caused this dependency to be added. cmLinkItem libBT = lib; libBT.Backtrace = dependee_backtrace; - this->AddTargetDepend(depender_index, libBT, true); + this->AddTargetDepend(depender_index, libBT, true, false); this->AddInterfaceDepends(depender_index, libBT, config, emitted); } } @@ -290,7 +293,8 @@ void cmComputeTargetDepends::AddInterfaceDepends( if (dependee) { // A target should not depend on itself. - emitted.insert(cmLinkItem(depender, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, false, cmListFileBacktrace())); + emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace())); this->AddInterfaceDepends(depender_index, dependee, dependee_name.Backtrace, config, emitted); } @@ -298,7 +302,7 @@ void cmComputeTargetDepends::AddInterfaceDepends( void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmLinkItem const& dependee_name, - bool linking) + bool linking, bool cross) { // Get the depender. cmGeneratorTarget const* depender = this->Targets[depender_index]; @@ -343,13 +347,13 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if (dependee) { this->AddTargetDepend(depender_index, dependee, dependee_name.Backtrace, - linking); + linking, cross); } } void cmComputeTargetDepends::AddTargetDepend( int depender_index, cmGeneratorTarget const* dependee, - cmListFileBacktrace const& dependee_backtrace, bool linking) + cmListFileBacktrace const& dependee_backtrace, bool linking, bool cross) { if (dependee->IsImported() || dependee->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -359,7 +363,7 @@ void cmComputeTargetDepends::AddTargetDepend( for (cmLinkItem const& i : utils) { if (cmGeneratorTarget const* transitive_dependee = i.Target) { this->AddTargetDepend(depender_index, transitive_dependee, i.Backtrace, - false); + false, i.Cross); } } } else { @@ -371,7 +375,7 @@ void cmComputeTargetDepends::AddTargetDepend( // Add this entry to the dependency graph. this->InitialGraph[depender_index].emplace_back(dependee_index, !linking, - dependee_backtrace); + cross, dependee_backtrace); } } @@ -505,7 +509,8 @@ bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap, for (cmGraphEdge const& edge : el) { int j = edge; if (cmap[j] == c && edge.IsStrong()) { - this->FinalGraph[i].emplace_back(j, true, edge.GetBacktrace()); + this->FinalGraph[i].emplace_back(j, true, edge.IsCross(), + edge.GetBacktrace()); if (!this->IntraComponent(cmap, c, j, head, emitted, visited)) { return false; } @@ -514,7 +519,8 @@ bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap, // Prepend to a linear linked-list of intra-component edges. if (*head >= 0) { - this->FinalGraph[i].emplace_back(*head, false, cmListFileBacktrace()); + this->FinalGraph[i].emplace_back(*head, false, false, + cmListFileBacktrace()); } else { this->ComponentTail[c] = i; } @@ -564,7 +570,8 @@ bool cmComputeTargetDepends::ComputeFinalDepends( int dependee_component = ni; int dependee_component_head = this->ComponentHead[dependee_component]; this->FinalGraph[depender_component_tail].emplace_back( - dependee_component_head, ni.IsStrong(), ni.GetBacktrace()); + dependee_component_head, ni.IsStrong(), ni.IsCross(), + ni.GetBacktrace()); } } return true; diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index d8060ae..e0d625f 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -46,10 +46,10 @@ private: void CollectDepends(); void CollectTargetDepends(int depender_index); void AddTargetDepend(int depender_index, cmLinkItem const& dependee_name, - bool linking); + bool linking, bool cross); void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee, cmListFileBacktrace const& dependee_backtrace, - bool linking); + bool linking, bool cross); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, cmLinkItem const& dependee_name, const std::string& config, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4dfc33d..5ef882c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -978,13 +978,15 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const { if (!this->UtilityItemsDone) { this->UtilityItemsDone = true; - std::set<BT<std::string>> const& utilities = this->GetUtilities(); - for (BT<std::string> const& i : utilities) { + std::set<BT<std::pair<std::string, bool>>> const& utilities = + this->GetUtilities(); + for (BT<std::pair<std::string, bool>> const& i : utilities) { if (cmGeneratorTarget* gt = - this->LocalGenerator->FindGeneratorTargetToUse(i.Value)) { - this->UtilityItems.insert(cmLinkItem(gt, i.Backtrace)); + this->LocalGenerator->FindGeneratorTargetToUse(i.Value.first)) { + this->UtilityItems.insert(cmLinkItem(gt, i.Value.second, i.Backtrace)); } else { - this->UtilityItems.insert(cmLinkItem(i.Value, i.Backtrace)); + this->UtilityItems.insert( + cmLinkItem(i.Value.first, i.Value.second, i.Backtrace)); } } } @@ -2182,7 +2184,8 @@ cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const return this->Target->GetBacktrace(); } -const std::set<BT<std::string>>& cmGeneratorTarget::GetUtilities() const +const std::set<BT<std::pair<std::string, bool>>>& +cmGeneratorTarget::GetUtilities() const { return this->Target->GetUtilities(); } @@ -2731,7 +2734,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) if (cmTarget* t = i->second.Target) { // The name is a byproduct of a utility target or a PRE_BUILD, PRE_LINK, or // POST_BUILD command. - this->GeneratorTarget->Target->AddUtility(t->GetName()); + this->GeneratorTarget->Target->AddUtility(t->GetName(), false); } if (cmSourceFile* sf = i->second.Source) { // For now only follow the dependency if the source file is not a @@ -2786,14 +2789,14 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) depLocation = cmSystemTools::CollapseFullPath(depLocation); tLocation = cmSystemTools::CollapseFullPath(tLocation); if (depLocation == tLocation) { - this->GeneratorTarget->Target->AddUtility(util); + this->GeneratorTarget->Target->AddUtility(util, false); return true; } } } else { // The original name of the dependency was not a full path. It // must name a target, so add the target-level dependency. - this->GeneratorTarget->Target->AddUtility(util); + this->GeneratorTarget->Target->AddUtility(util, false); return true; } } @@ -2821,7 +2824,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) // this project. Add the target-level dependency to make // sure the executable is up to date before this custom // command possibly runs. - this->GeneratorTarget->Target->AddUtility(command); + this->GeneratorTarget->Target->AddUtility(command, true); } } @@ -2836,7 +2839,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) } for (cmGeneratorTarget* target : targets) { - this->GeneratorTarget->Target->AddUtility(target->GetName()); + this->GeneratorTarget->Target->AddUtility(target->GetName(), true); } // Queue the custom command dependencies. @@ -6681,7 +6684,7 @@ cmLinkItem cmGeneratorTarget::ResolveLinkItem(std::string const& name, TargetOrString resolved = this->ResolveTargetReference(name, lg); if (!resolved.Target) { - return cmLinkItem(resolved.String, bt); + return cmLinkItem(resolved.String, false, bt); } // Check deprecation, issue message with `bt` backtrace. @@ -6702,10 +6705,10 @@ cmLinkItem cmGeneratorTarget::ResolveLinkItem(std::string const& name, // within the project. if (resolved.Target->GetType() == cmStateEnums::EXECUTABLE && !resolved.Target->IsExecutableWithExports()) { - return cmLinkItem(resolved.Target->GetName(), bt); + return cmLinkItem(resolved.Target->GetName(), false, bt); } - return cmLinkItem(resolved.Target, bt); + return cmLinkItem(resolved.Target, false, bt); } std::string cmGeneratorTarget::GetPDBDirectory(const std::string& config) const diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b647b25..d81bb3d 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -291,7 +291,7 @@ public: cmListFileBacktrace GetBacktrace() const; - std::set<BT<std::string>> const& GetUtilities() const; + std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const; bool LinkLanguagePropagatesToDependents() const { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7ddeb99..ff6ad9d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2689,7 +2689,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, target.SetProperty("EchoString", gti.Message); } for (std::string const& d : gti.Depends) { - target.AddUtility(d); + target.AddUtility(d, false); } // Organize in the "predefined targets" folder: diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 35421b6..b1e26b2 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1125,10 +1125,11 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { // These depend only on other CMake-provided targets, e.g. "all". - for (BT<std::string> const& util : target->GetUtilities()) { + for (BT<std::pair<std::string, bool>> const& util : + target->GetUtilities()) { std::string d = target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + - util.Value; + util.Value.first; outputs.push_back(this->BuildAlias(this->ConvertToNinjaPath(d), config)); } } else { @@ -1138,10 +1139,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( if (targetDep->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - // For some reason, object libraries show up as "utility" dependencies - // even though they're used for linking. Treat them as link dependencies. - if (targetDep.IsUtil() && - targetDep->GetType() != cmStateEnums::OBJECT_LIBRARY) { + if (targetDep.IsCross()) { this->AppendTargetOutputs(targetDep, outs, fileConfig, depends); } else { this->AppendTargetOutputs(targetDep, outs, config, depends); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index ec1380b..d0aec61 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -157,7 +157,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends( // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteExternalProject( std::ostream& fout, const std::string& name, const std::string& location, - const char* typeGuid, const std::set<BT<std::string>>& depends) + const char* typeGuid, + const std::set<BT<std::pair<std::string, bool>>>& depends) { fout << "Project(\"{" << (typeGuid ? typeGuid : this->ExternalProjectType(location)) @@ -169,8 +170,8 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( // project instead of in the global section if (!depends.empty()) { fout << "\tProjectSection(ProjectDependencies) = postProject\n"; - for (BT<std::string> const& it : depends) { - std::string const& dep = it.Value; + for (BT<std::pair<std::string, bool>> const& it : depends) { + std::string const& dep = it.Value.first; if (!dep.empty()) { fout << "\t\t{" << this->GetGUID(dep) << "} = {" << this->GetGUID(dep) << "}\n"; diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 61a2f6f..7eadaf3 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -32,9 +32,10 @@ protected: cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, const std::string& platformMapping = "") override; - void WriteExternalProject(std::ostream& fout, const std::string& name, - const std::string& path, const char* typeGuid, - const std::set<BT<std::string>>& depends) override; + void WriteExternalProject( + std::ostream& fout, const std::string& name, const std::string& path, + const char* typeGuid, + const std::set<BT<std::pair<std::string, bool>>>& depends) override; // Folders are not supported by VS 7.1. bool UseFolderProperty() const override { return false; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 699f091..6cc1cf8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -143,7 +143,8 @@ protected: virtual void WriteExternalProject( std::ostream& fout, const std::string& name, const std::string& path, - const char* typeGuid, const std::set<BT<std::string>>& dependencies) = 0; + const char* typeGuid, + const std::set<BT<std::pair<std::string, bool>>>& dependencies) = 0; std::string ConvertToSolutionPath(const std::string& path); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index c0551f7..1c62fbd 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -211,7 +211,7 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets() // All targets depend on the build-system check target. for (const auto& ti : tgts) { if (ti->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { - ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + ti->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false); } } } @@ -325,9 +325,10 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( cmGeneratorTarget* target) { // Look for utility dependencies that magically link. - for (BT<std::string> const& ui : target->GetUtilities()) { + for (BT<std::pair<std::string, bool>> const& ui : target->GetUtilities()) { if (cmGeneratorTarget* depTarget = - target->GetLocalGenerator()->FindGeneratorTargetToUse(ui.Value)) { + target->GetLocalGenerator()->FindGeneratorTargetToUse( + ui.Value.first)) { if (depTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) { // This utility dependency names an external .vcproj target. diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 012a77c..1ec1559 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -219,7 +219,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() continue; } if (!this->IsExcluded(gen[0], tgt.get())) { - allBuild->AddUtility(tgt->GetName()); + allBuild->AddUtility(tgt->GetName(), false); } } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7ec4e65..c48a376 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -552,7 +552,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( if (regenerate && (target->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)) { - target->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + target->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false); } // make all exe, shared libs and modules @@ -571,7 +571,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( } if (!this->IsExcluded(gens[0], target.get())) { - allbuild->AddUtility(target->GetName()); + allbuild->AddUtility(target->GetName(), false); } } } diff --git a/Source/cmGraphAdjacencyList.h b/Source/cmGraphAdjacencyList.h index 5ed6af4..4e1f128 100644 --- a/Source/cmGraphAdjacencyList.h +++ b/Source/cmGraphAdjacencyList.h @@ -18,9 +18,10 @@ class cmGraphEdge { public: - cmGraphEdge(int n, bool s, cmListFileBacktrace bt) + cmGraphEdge(int n, bool s, bool c, cmListFileBacktrace bt) : Dest(n) , Strong(s) + , Cross(c) , Backtrace(std::move(bt)) { } @@ -28,11 +29,14 @@ public: bool IsStrong() const { return this->Strong; } + bool IsCross() const { return this->Cross; } + cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } private: int Dest; bool Strong; + bool Cross; cmListFileBacktrace Backtrace; }; struct cmGraphEdgeList : public std::vector<cmGraphEdge> diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index f48789a..1b77678 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -289,7 +289,7 @@ void cmGraphVizWriter::Write() } for (auto const gt : sortedGeneratorTargets) { - auto item = cmLinkItem(gt, gt->GetBacktrace()); + auto item = cmLinkItem(gt, false, gt->GetBacktrace()); this->VisitItem(item); } } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 86a0921..5b532ce 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -97,7 +97,7 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args, target->SetProperty("VS_PLATFORM_MAPPING", platformMapping); for (std::string const& d : depends) { - target->AddUtility(d); + target->AddUtility(d, false); } } #endif diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx index 91eb183..4e50d70 100644 --- a/Source/cmLinkItem.cxx +++ b/Source/cmLinkItem.cxx @@ -8,14 +8,17 @@ cmLinkItem::cmLinkItem() = default; -cmLinkItem::cmLinkItem(std::string n, cmListFileBacktrace bt) +cmLinkItem::cmLinkItem(std::string n, bool c, cmListFileBacktrace bt) : String(std::move(n)) + , Cross(c) , Backtrace(std::move(bt)) { } -cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt) +cmLinkItem::cmLinkItem(cmGeneratorTarget const* t, bool c, + cmListFileBacktrace bt) : Target(t) + , Cross(c) , Backtrace(std::move(bt)) { } @@ -39,12 +42,16 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r) return false; } // Order among strings. - return l.String < r.String; + if (l.String < r.String) { + return true; + } + // Order among cross-config. + return l.Cross < r.Cross; } bool operator==(cmLinkItem const& l, cmLinkItem const& r) { - return l.Target == r.Target && l.String == r.String; + return l.Target == r.Target && l.String == r.String && l.Cross == r.Cross; } std::ostream& operator<<(std::ostream& os, cmLinkItem const& item) diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h index 2d9378b..0ea25c0 100644 --- a/Source/cmLinkItem.h +++ b/Source/cmLinkItem.h @@ -24,10 +24,11 @@ class cmLinkItem public: cmLinkItem(); - cmLinkItem(std::string s, cmListFileBacktrace bt); - cmLinkItem(cmGeneratorTarget const* t, cmListFileBacktrace bt); + cmLinkItem(std::string s, bool c, cmListFileBacktrace bt); + cmLinkItem(cmGeneratorTarget const* t, bool c, cmListFileBacktrace bt); std::string const& AsStr() const; cmGeneratorTarget const* Target = nullptr; + bool Cross = false; cmListFileBacktrace Backtrace; friend bool operator<(cmLinkItem const& l, cmLinkItem const& r); friend bool operator==(cmLinkItem const& l, cmLinkItem const& r); diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx index ab2cf9e..acc23c8 100644 --- a/Source/cmLinkItemGraphVisitor.cxx +++ b/Source/cmLinkItemGraphVisitor.cxx @@ -127,7 +127,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target, for (auto const& lib : objectLibraries) { auto const& name = lib->GetName(); if (dependencies.find(name) == dependencies.cend()) { - auto objectItem = cmLinkItem(lib, lib->GetBacktrace()); + auto objectItem = cmLinkItem(lib, false, lib->GetBacktrace()); dependencies[name] = Dependency(DependencyType::Object, objectItem); } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d037b93..63c6680 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1579,8 +1579,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( text = "Running external command ..."; } depends.reserve(gt->GetUtilities().size()); - for (BT<std::string> const& u : gt->GetUtilities()) { - depends.push_back(u.Value); + for (BT<std::pair<std::string, bool>> const& u : gt->GetUtilities()) { + depends.push_back(u.Value.first); } this->AppendEcho(commands, text, cmLocalUnixMakefileGenerator3::EchoGlobal); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index ff79a17..0a6da91 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -197,7 +197,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule( // build response file name std::string responseFlag = this->GetMakefile()->GetSafeDefinition( - "CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG"); + "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG"); if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; @@ -311,7 +311,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, if (flag) { responseFlag = flag; - } else if (this->TargetLinkLanguage(config) != "CUDA") { + } else { responseFlag = "@"; } diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index db5a8ba..7a6cb42 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -180,7 +180,7 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoGen( if (it != GlobalAutoGenTargets_.end()) { cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(it->second); if (target != nullptr) { - target->Target->AddUtility(targetName, localGen->GetMakefile()); + target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } } } @@ -192,7 +192,7 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc( if (it != GlobalAutoRccTargets_.end()) { cmGeneratorTarget* target = localGen->FindGeneratorTargetToUse(it->second); if (target != nullptr) { - target->Target->AddUtility(targetName, localGen->GetMakefile()); + target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 43e159c..629367d 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1125,7 +1125,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() if (usePRE_BUILD) { // Add additional autogen target dependencies to origin target for (cmTarget* depTarget : this->AutogenTarget.DependTargets) { - this->GenTarget->Target->AddUtility(depTarget->GetName(), + this->GenTarget->Target->AddUtility(depTarget->GetName(), false, this->Makefile); } @@ -1229,14 +1229,15 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // Forward origin utilities to autogen target if (this->AutogenTarget.DependOrigin) { - for (BT<std::string> const& depName : this->GenTarget->GetUtilities()) { - autogenTarget->AddUtility(depName.Value, this->Makefile); + for (BT<std::pair<std::string, bool>> const& depName : + this->GenTarget->GetUtilities()) { + autogenTarget->AddUtility(depName.Value.first, false, this->Makefile); } } if (!useNinjaDepfile) { // Add additional autogen target dependencies to autogen target for (cmTarget* depTarget : this->AutogenTarget.DependTargets) { - autogenTarget->AddUtility(depTarget->GetName(), this->Makefile); + autogenTarget->AddUtility(depTarget->GetName(), false, this->Makefile); } } @@ -1246,7 +1247,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() } // Add autogen target to the origin target dependencies - this->GenTarget->Target->AddUtility(this->AutogenTarget.Name, + this->GenTarget->Target->AddUtility(this->AutogenTarget.Name, false, this->Makefile); // Add autogen target to the global autogen target dependencies @@ -1317,12 +1318,12 @@ bool cmQtAutoGenInitializer::InitRccTargets() autoRccTarget->SetProperty("FOLDER", this->TargetsFolder); } if (!this->Rcc.ExecutableTargetName.empty()) { - autoRccTarget->AddUtility(this->Rcc.ExecutableTargetName, + autoRccTarget->AddUtility(this->Rcc.ExecutableTargetName, false, this->Makefile); } } // Add autogen target to the origin target dependencies - this->GenTarget->Target->AddUtility(ccName, this->Makefile); + this->GenTarget->Target->AddUtility(ccName, false, this->Makefile); // Add autogen target to the global autogen target dependencies if (this->Rcc.GlobalTarget) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d0b6f10..97d7fce 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -178,7 +178,7 @@ public: bool ImportedGloballyVisible; bool BuildInterfaceIncludesAppended; bool PerConfig; - std::set<BT<std::string>> Utilities; + std::set<BT<std::pair<std::string, bool>>> Utilities; std::vector<cmCustomCommand> PreBuildCommands; std::vector<cmCustomCommand> PreLinkCommands; std::vector<cmCustomCommand> PostBuildCommands; @@ -583,13 +583,14 @@ cmGlobalGenerator* cmTarget::GetGlobalGenerator() const return impl->Makefile->GetGlobalGenerator(); } -void cmTarget::AddUtility(std::string const& name, cmMakefile* mf) +void cmTarget::AddUtility(std::string const& name, bool cross, cmMakefile* mf) { - impl->Utilities.insert( - BT<std::string>(name, mf ? mf->GetBacktrace() : cmListFileBacktrace())); + impl->Utilities.insert(BT<std::pair<std::string, bool>>( + { name, cross }, mf ? mf->GetBacktrace() : cmListFileBacktrace())); } -std::set<BT<std::string>> const& cmTarget::GetUtilities() const +std::set<BT<std::pair<std::string, bool>>> const& cmTarget::GetUtilities() + const { return impl->Utilities; } @@ -1293,7 +1294,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->SetProperty("COMPILE_PDB_NAME", reusedTarget->GetProperty("COMPILE_PDB_NAME")); - this->AddUtility(reusedFrom, impl->Makefile); + this->AddUtility(reusedFrom, false, impl->Makefile); } else { impl->Properties.SetProperty(prop, value); } @@ -1720,7 +1721,14 @@ const char* cmTarget::GetProperty(const std::string& prop) const } static std::string output; - output = cmJoin(impl->Utilities, ";"); + static std::vector<std::string> utilities; + utilities.resize(impl->Utilities.size()); + std::transform( + impl->Utilities.cbegin(), impl->Utilities.cend(), utilities.begin(), + [](const BT<std::pair<std::string, bool>>& item) -> std::string { + return item.Value.first; + }); + output = cmJoin(utilities, ";"); return output.c_str(); } if (prop == propPRECOMPILE_HEADERS) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d4cca23..286933b 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -156,9 +156,10 @@ public: * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE * commands. It is not a full path nor does it have an extension. */ - void AddUtility(std::string const& name, cmMakefile* mf = nullptr); + void AddUtility(std::string const& name, bool cross, + cmMakefile* mf = nullptr); //! Get the utilities used by this target - std::set<BT<std::string>> const& GetUtilities() const; + std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const; //! Set/Get a property of this target file void SetProperty(const std::string& prop, const char* value); diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 4ca78fa..5452cc7 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -19,6 +19,7 @@ class cmTargetDepend // mutable members to achieve a map with set syntax. mutable bool Link; mutable bool Util; + mutable bool Cross; mutable cmListFileBacktrace Backtrace; public: @@ -26,6 +27,7 @@ public: : Target(t) , Link(false) , Util(false) + , Cross(false) { } operator cmGeneratorTarget const*() const { return this->Target; } @@ -43,12 +45,14 @@ public: this->Link = true; } } + void SetCross(bool cross) const { this->Cross = cross; } void SetBacktrace(cmListFileBacktrace const& bt) const { this->Backtrace = bt; } bool IsLink() const { return this->Link; } bool IsUtil() const { return this->Util; } + bool IsCross() const { return this->Cross; } cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } }; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 39873e6..d27081b 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2186,12 +2186,15 @@ bool SystemTools::CopyFileIfDifferent(const std::string& source, // FilesDiffer does not handle file to directory compare if (SystemTools::FileIsDirectory(destination)) { const std::string new_destination = FileInDir(source, destination); - return SystemTools::CopyFileIfDifferent(source, new_destination); - } - // source and destination are files so do a copy if they - // are different - if (SystemTools::FilesDiffer(source, destination)) { - return SystemTools::CopyFileAlways(source, destination); + if (!SystemTools::ComparePath(new_destination, destination)) { + return SystemTools::CopyFileIfDifferent(source, new_destination); + } + } else { + // source and destination are files so do a copy if they + // are different + if (SystemTools::FilesDiffer(source, destination)) { + return SystemTools::CopyFileAlways(source, destination); + } } // at this point the files must be the same so return true return true; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 1f3a15b..3f6eeb8 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -1074,6 +1074,15 @@ static bool CheckCopyFileIfDifferent() } } + if (!kwsys::SystemTools::MakeDirectory("dir_a") || + !kwsys::SystemTools::MakeDirectory("dir_b")) { + return false; + } + + if (!kwsys::SystemTools::CopyFileIfDifferent("dir_a/", "dir_b")) { + ret = false; + } + return ret; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6fad175..33c7514 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3423,17 +3423,6 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) endif() - # If this is not an in-source build, provide a target to wipe out - # all the test build directories. - if(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") - configure_file(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in - ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY) - add_custom_target(test_clean - COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake - COMMENT "Removing test build directories." - ) - endif() - # Define a set of "contract" tests, each activated by a cache entry # named "CMake_TEST_CONTRACT_<project>". For each Contract test, # the project should provide a directory with a CMakeLists.txt file @@ -3508,4 +3497,16 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeTests) endif() + + # If this is not an in-source build, provide a target to wipe out + # all the test build directories. This must come at the end after + # all the above logic has finished adding to TEST_BUILD_DIRS + if(NOT EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") + configure_file(${CMake_SOURCE_DIR}/Tests/test_clean.cmake.in + ${CMake_BINARY_DIR}/Tests/test_clean.cmake @ONLY) + add_custom_target(test_clean + COMMAND ${CMAKE_COMMAND} -P ${CMake_BINARY_DIR}/Tests/test_clean.cmake + COMMENT "Removing test build directories." + ) + endif() endif() diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index ef81169..450e7e5 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -380,7 +380,9 @@ if(do_git_tests) set(proj TutorialStep1-GIT-config) ExternalProject_Add(${proj} GIT_REPOSITORY "${local_git_repo}" - GIT_CONFIG core.eol=lf core.autocrlf=input + GIT_CONFIG core.eol=lf + core.autocrlf=input + "http.extraheader=AUTHORIZATION: bearer --unsupportedOption" CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" @@ -661,11 +663,19 @@ if(do_git_tests) add_test(TutorialStep1-GIT-bytag "${binary_base}/TutorialStep1-GIT-bytag/Tutorial" 99) + add_test(TutorialStep1-GIT-bytag-withsubmodules + "${binary_base}/TutorialStep1-GIT-bytag-withsubmodules/Tutorial" 99) + add_test(TutorialStep1-GIT-shallow-master "${binary_base}/TutorialStep1-GIT-shallow-master/Tutorial" 98) add_test(TutorialStep1-GIT-master "${binary_base}/TutorialStep1-GIT-master/Tutorial" 98) + + if(NOT git_version VERSION_LESS 1.7.7) + add_test(TutorialStep1-GIT-config + "${binary_base}/TutorialStep1-GIT-config/Tutorial" 98) + endif() endif() diff --git a/Tests/Qt4Autogen/CMakeLists.txt b/Tests/Qt4Autogen/CMakeLists.txt index 68b885b..e7f1ae3 100644 --- a/Tests/Qt4Autogen/CMakeLists.txt +++ b/Tests/Qt4Autogen/CMakeLists.txt @@ -7,3 +7,5 @@ ADD_AUTOGEN_TEST(DefinesTest) # Common tests include("../QtAutogen/Tests.cmake") + +set(TEST_BUILD_DIRS "${TEST_BUILD_DIRS}" PARENT_SCOPE) diff --git a/Tests/Qt5Autogen/CMakeLists.txt b/Tests/Qt5Autogen/CMakeLists.txt index 49d33cc..df4927a 100644 --- a/Tests/Qt5Autogen/CMakeLists.txt +++ b/Tests/Qt5Autogen/CMakeLists.txt @@ -4,3 +4,5 @@ include("../QtAutogen/TestMacros.cmake") # Common tests include("../QtAutogen/Tests.cmake") + +set(TEST_BUILD_DIRS "${TEST_BUILD_DIRS}" PARENT_SCOPE) diff --git a/Tests/RunCMake/NinjaMultiConfig/FrameworkDependencyAutogen.cmake b/Tests/RunCMake/NinjaMultiConfig/FrameworkDependencyAutogen.cmake new file mode 100644 index 0000000..75e21b9 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/FrameworkDependencyAutogen.cmake @@ -0,0 +1,20 @@ +enable_language(C) + +set(CMAKE_LINK_DEPENDS_NO_SHARED ON) + +set(QT_VERSION_MAJOR 6) +set(fake_moc_path "${CMAKE_CURRENT_BINARY_DIR}/fake_moc") +file(WRITE "${fake_moc_path}" "") + +add_library(test1 SHARED simplelib.c) +add_library(test2 SHARED empty.c) +target_link_libraries(test2 test1) + +set_target_properties(test1 test2 PROPERTIES + FRAMEWORK ON + AUTOMOC ON + AUTOMOC_EXECUTABLE "${fake_moc_path}" + ) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) +generate_output_files(test1 test2) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 9058b11..a608e9e 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -198,6 +198,13 @@ unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) run_cmake_build(Framework framework Debug all) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/FrameworkDependencyAutogen-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NMC_CROSS_CONFIGS=all") +run_cmake_configure(FrameworkDependencyAutogen) +unset(RunCMake_TEST_OPTIONS) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_cmake_build(FrameworkDependencyAutogen framework Release test2:Debug) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_NMC_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandGenerator) |