diff options
author | Brad King <brad.king@kitware.com> | 2015-10-21 13:16:56 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-10-21 13:16:56 (GMT) |
commit | 740f85a204d7a837e3ad408a79992f6a9c0b000c (patch) | |
tree | 55e55d20f5f8777e5c1e860e3a0d476a40d26255 | |
parent | 8bcf2c81fc2a2bc458d54f9d5dbd40b49e5b993e (diff) | |
parent | a4bbdc5ecf4d2b66346e1006cee891acf95c8ad8 (diff) | |
download | CMake-740f85a204d7a837e3ad408a79992f6a9c0b000c.zip CMake-740f85a204d7a837e3ad408a79992f6a9c0b000c.tar.gz CMake-740f85a204d7a837e3ad408a79992f6a9c0b000c.tar.bz2 |
Merge topic 'cmLocalGenerator-generator-target-storage'
a4bbdc5e cmLocalGenerator: Remove cmGeneratorTargetsType from setter API.
04b6bb16 cmLocalGenerator: Simplify semantic of adding generator targets.
400e3d19 cmLocalGenerator: Don't store imported generator targets
726e461b CMP0063: Split unit test by target type.
20 files changed, 84 insertions, 94 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 236fb7d..31c05fd 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -969,10 +969,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); ++l) { - if (l->first->IsImported()) - { - continue; - } std::vector<std::string> includeDirs; std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1142ddd..a55365f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1574,7 +1574,6 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator *lg) { - cmGeneratorTargetsType generatorTargets; cmMakefile* mf = lg->GetMakefile(); if (targetTypes == AllTargets) { @@ -1585,7 +1584,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, cmTarget* t = &ti->second; cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->GeneratorTargets[t] = gt; - generatorTargets[t] = gt; + lg->AddGeneratorTarget(t, gt); } } @@ -1595,9 +1594,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, { cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg); this->GeneratorTargets[*j] = gt; - generatorTargets[*j] = gt; } - lg->SetGeneratorTargets(generatorTargets); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 8e671a3..44e3de6 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -473,10 +473,6 @@ cmGlobalUnixMakefileGenerator3 (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY)) { - if(gtarget->IsImported()) - { - continue; - } // Add this to the list of depends rules in this directory. if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || @@ -632,10 +628,6 @@ cmGlobalUnixMakefileGenerator3 t != targets.end(); ++t) { cmGeneratorTarget* gtarget = t->second; - if(gtarget->IsImported()) - { - continue; - } // Don't emit the same rule twice (e.g. two targets with the same // simple name) int type = gtarget->GetType(); @@ -733,10 +725,6 @@ cmGlobalUnixMakefileGenerator3 t != targets.end(); ++t) { cmGeneratorTarget* gtarget = t->second; - if(gtarget->IsImported()) - { - continue; - } int type = gtarget->GetType(); std::string name = gtarget->GetName(); if (!name.empty() diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 0c41964..61b19cf 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -257,6 +257,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); lg->AddGeneratorTarget(tgt, gt); + this->AddGeneratorTarget(tgt, gt); // Organize in the "predefined targets" folder: // diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 9af5b35..91ca9a3 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -88,6 +88,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); gen[0]->AddGeneratorTarget(allBuild, gt); + this->AddGeneratorTarget(allBuild, gt); #if 0 // Can't activate this code because we want ALL_BUILD diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ea1b1a0..3838ebc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -460,6 +460,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); root->AddGeneratorTarget(allbuild, allBuildGt); + root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt); // Refer to the main build configuration file for easy editing. std::string listfile = root->GetCurrentSourceDirectory(); @@ -495,6 +496,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); root->AddGeneratorTarget(check, checkGt); + root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt); } // now make the allbuild depend on all the non-utility targets diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9d5dd8e..833ffbf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -136,8 +136,7 @@ void cmLocalGenerator::TraceDependencies() for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if (t->second->Target->IsImported() - || t->second->GetType() == cmState::INTERFACE_LIBRARY) + if (t->second->GetType() == cmState::INTERFACE_LIBRARY) { continue; } @@ -452,7 +451,6 @@ void cmLocalGenerator::GenerateInstallRules() void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) { this->GeneratorTargets[t] = gt; - this->GetGlobalGenerator()->AddGeneratorTarget(t, gt); } //---------------------------------------------------------------------------- @@ -476,10 +474,6 @@ void cmLocalGenerator::ComputeTargetManifest() { continue; } - if (target.IsImported()) - { - continue; - } for(std::vector<std::string>::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2bc0e4a..307c67f 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -118,10 +118,6 @@ public: return this->GeneratorTargets; } - void SetGeneratorTargets(const cmGeneratorTargetsType &targets) - { - this->GeneratorTargets = targets; - } void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt); cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index a408a23..869ba2c 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -31,8 +31,7 @@ void cmLocalGhsMultiGenerator::Generate() for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if (l->second->GetType() == cmState::INTERFACE_LIBRARY - || l->second->IsImported()) + if (l->second->GetType() == cmState::INTERFACE_LIBRARY) { continue; } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4da77e0..756c139 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -77,8 +77,7 @@ void cmLocalNinjaGenerator::Generate() for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if (t->second->GetType() == cmState::INTERFACE_LIBRARY - || t->second->Target->IsImported()) + if (t->second->GetType() == cmState::INTERFACE_LIBRARY) { continue; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index add0aa9..5485da4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -119,8 +119,7 @@ void cmLocalUnixMakefileGenerator3::Generate() for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if (t->second->GetType() == cmState::INTERFACE_LIBRARY - || t->second->Target->IsImported()) + if (t->second->GetType() == cmState::INTERFACE_LIBRARY) { continue; } @@ -430,11 +429,6 @@ void cmLocalUnixMakefileGenerator3 (t->second->GetType() == cmState::OBJECT_LIBRARY) || (t->second->GetType() == cmState::UTILITY)) { - if (t->second->Target->IsImported()) - { - continue; - } - emitted.insert(t->second->GetName()); // for subdirs add a rule to build this specific target by name. diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 386d430..16b8942 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -896,6 +896,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); lg->AddGeneratorTarget(autogenTarget, gt); + lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt); // Set target folder const char* autogenFolder = makefile->GetState() diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt new file mode 100644 index 0000000..b8d726f --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-exe.cmake:[0-9]+ \(add_executable\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "myexe" of type "EXECUTABLE" has the following visibility properties + set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake index 3388e4d..cef1d75 100644 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake @@ -5,4 +5,7 @@ enable_language(CXX) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") -include(CMP0063-Common.cmake) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_executable(myexe lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt new file mode 100644 index 0000000..3a7732a --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-obj.cmake:[0-9]+ \(add_library\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "myobject" of type "OBJECT_LIBRARY" has the following visibility + properties set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake new file mode 100644 index 0000000..81d1c33 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake @@ -0,0 +1,11 @@ + +enable_language(CXX) + +# Ensure CMake warns even if toolchain does not really have these flags. +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_library(myobject OBJECT lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt new file mode 100644 index 0000000..1efa1b5 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) at CMP0063-WARN-sta.cmake:[0-9]+ \(add_library\): + Policy CMP0063 is not set: Honor visibility properties for all target + types. Run "cmake --help-policy CMP0063" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + Target "mystatic" of type "STATIC_LIBRARY" has the following visibility + properties set for CXX: + + CXX_VISIBILITY_PRESET + VISIBILITY_INLINES_HIDDEN + + For compatibility CMake is not honoring them for this target. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake new file mode 100644 index 0000000..132e076 --- /dev/null +++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake @@ -0,0 +1,11 @@ + +enable_language(CXX) + +# Ensure CMake warns even if toolchain does not really have these flags. +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +add_library(mystatic STATIC lib.cpp) diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt deleted file mode 100644 index 59a4b8f..0000000 --- a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt +++ /dev/null @@ -1,50 +0,0 @@ -^CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_executable\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "myexe" of type "EXECUTABLE" has the following visibility properties - set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "myobject" of type "OBJECT_LIBRARY" has the following visibility - properties set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\): - Policy CMP0063 is not set: Honor visibility properties for all target - types. Run "cmake --help-policy CMP0063" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - Target "mystatic" of type "STATIC_LIBRARY" has the following visibility - properties set for CXX: - - CXX_VISIBILITY_PRESET - VISIBILITY_INLINES_HIDDEN - - For compatibility CMake is not honoring them for this target. -Call Stack \(most recent call first\): - CMP0063-WARN-yes.cmake:[0-9]+ \(include\) - CMakeLists.txt:[0-9]+ \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake index c7eb808..7a000ee 100644 --- a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake +++ b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(PropertyTypo) run_cmake(CMP0063-OLD) -run_cmake(CMP0063-WARN-yes) +run_cmake(CMP0063-WARN-exe) +run_cmake(CMP0063-WARN-obj) +run_cmake(CMP0063-WARN-sta) run_cmake(CMP0063-WARN-no) run_cmake(CMP0063-NEW) |