diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 236fb7d1e..31c05fd06 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 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 1142ddd2e..a55365f5d 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 8e671a36f..44e3de6ce 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 0c419641e..61b19cfcc 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 9af5b3536..91ca9a31d 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 ea1b1a086..3838ebc04 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 9d5dd8e78..833ffbf1b 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::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2bc0e4aca..307c67ff9 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 a408a2338..869ba2c1e 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 4da77e03b..756c1398e 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 add0aa921..5485da417 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 386d43002..16b8942b7 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 000000000..b8d726f8f --- /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 similarity index 68% rename from Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake rename to Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake index 3388e4db0..cef1d7521 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 000000000..3a7732a65 --- /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 000000000..81d1c339b --- /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 000000000..1efa1b5b0 --- /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 000000000..132e076e2 --- /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 59a4b8f1a..000000000 --- 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 c7eb80835..7a000ee9a 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)