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.
This commit is contained in:
Brad King 2015-10-21 09:16:56 -04:00 committed by CMake Topic Stage
commit 740f85a204
20 changed files with 84 additions and 94 deletions

View File

@ -969,10 +969,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
for (cmGeneratorTargetsType::iterator l = targets.begin(); for (cmGeneratorTargetsType::iterator l = targets.begin();
l != targets.end(); ++l) l != targets.end(); ++l)
{ {
if (l->first->IsImported())
{
continue;
}
std::vector<std::string> includeDirs; std::vector<std::string> includeDirs;
std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
(*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config);

View File

@ -1574,7 +1574,6 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
cmLocalGenerator *lg) cmLocalGenerator *lg)
{ {
cmGeneratorTargetsType generatorTargets;
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
if (targetTypes == AllTargets) if (targetTypes == AllTargets)
{ {
@ -1585,7 +1584,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
cmTarget* t = &ti->second; cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt; 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); cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg);
this->GeneratorTargets[*j] = gt; this->GeneratorTargets[*j] = gt;
generatorTargets[*j] = gt;
} }
lg->SetGeneratorTargets(generatorTargets);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -473,10 +473,6 @@ cmGlobalUnixMakefileGenerator3
(type == cmState::OBJECT_LIBRARY) || (type == cmState::OBJECT_LIBRARY) ||
(type == cmState::UTILITY)) (type == cmState::UTILITY))
{ {
if(gtarget->IsImported())
{
continue;
}
// Add this to the list of depends rules in this directory. // Add this to the list of depends rules in this directory.
if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink || (!check_relink ||
@ -632,10 +628,6 @@ cmGlobalUnixMakefileGenerator3
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = t->second;
if(gtarget->IsImported())
{
continue;
}
// Don't emit the same rule twice (e.g. two targets with the same // Don't emit the same rule twice (e.g. two targets with the same
// simple name) // simple name)
int type = gtarget->GetType(); int type = gtarget->GetType();
@ -733,10 +725,6 @@ cmGlobalUnixMakefileGenerator3
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = t->second;
if(gtarget->IsImported())
{
continue;
}
int type = gtarget->GetType(); int type = gtarget->GetType();
std::string name = gtarget->GetName(); std::string name = gtarget->GetName();
if (!name.empty() if (!name.empty()

View File

@ -257,6 +257,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
lg->AddGeneratorTarget(tgt, gt); lg->AddGeneratorTarget(tgt, gt);
this->AddGeneratorTarget(tgt, gt);
// Organize in the "predefined targets" folder: // Organize in the "predefined targets" folder:
// //

View File

@ -88,6 +88,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
gen[0]->AddGeneratorTarget(allBuild, gt); gen[0]->AddGeneratorTarget(allBuild, gt);
this->AddGeneratorTarget(allBuild, gt);
#if 0 #if 0
// Can't activate this code because we want ALL_BUILD // Can't activate this code because we want ALL_BUILD

View File

@ -460,6 +460,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
root->AddGeneratorTarget(allbuild, allBuildGt); root->AddGeneratorTarget(allbuild, allBuildGt);
root->GetGlobalGenerator()->AddGeneratorTarget(allbuild, allBuildGt);
// Refer to the main build configuration file for easy editing. // Refer to the main build configuration file for easy editing.
std::string listfile = root->GetCurrentSourceDirectory(); std::string listfile = root->GetCurrentSourceDirectory();
@ -495,6 +496,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
root->AddGeneratorTarget(check, checkGt); root->AddGeneratorTarget(check, checkGt);
root->GetGlobalGenerator()->AddGeneratorTarget(check, checkGt);
} }
// now make the allbuild depend on all the non-utility targets // now make the allbuild depend on all the non-utility targets

View File

@ -136,8 +136,7 @@ void cmLocalGenerator::TraceDependencies()
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->Target->IsImported() if (t->second->GetType() == cmState::INTERFACE_LIBRARY)
|| t->second->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
@ -452,7 +451,6 @@ void cmLocalGenerator::GenerateInstallRules()
void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
{ {
this->GeneratorTargets[t] = gt; this->GeneratorTargets[t] = gt;
this->GetGlobalGenerator()->AddGeneratorTarget(t, gt);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -476,10 +474,6 @@ void cmLocalGenerator::ComputeTargetManifest()
{ {
continue; continue;
} }
if (target.IsImported())
{
continue;
}
for(std::vector<std::string>::iterator ci = configNames.begin(); for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci) ci != configNames.end(); ++ci)
{ {

View File

@ -118,10 +118,6 @@ public:
return this->GeneratorTargets; return this->GeneratorTargets;
} }
void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
{
this->GeneratorTargets = targets;
}
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt); void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt);
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;

View File

@ -31,8 +31,7 @@ void cmLocalGhsMultiGenerator::Generate()
for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end();
++l) ++l)
{ {
if (l->second->GetType() == cmState::INTERFACE_LIBRARY if (l->second->GetType() == cmState::INTERFACE_LIBRARY)
|| l->second->IsImported())
{ {
continue; continue;
} }

View File

@ -77,8 +77,7 @@ void cmLocalNinjaGenerator::Generate()
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::INTERFACE_LIBRARY if (t->second->GetType() == cmState::INTERFACE_LIBRARY)
|| t->second->Target->IsImported())
{ {
continue; continue;
} }

View File

@ -119,8 +119,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::INTERFACE_LIBRARY if (t->second->GetType() == cmState::INTERFACE_LIBRARY)
|| t->second->Target->IsImported())
{ {
continue; continue;
} }
@ -430,11 +429,6 @@ void cmLocalUnixMakefileGenerator3
(t->second->GetType() == cmState::OBJECT_LIBRARY) || (t->second->GetType() == cmState::OBJECT_LIBRARY) ||
(t->second->GetType() == cmState::UTILITY)) (t->second->GetType() == cmState::UTILITY))
{ {
if (t->second->Target->IsImported())
{
continue;
}
emitted.insert(t->second->GetName()); emitted.insert(t->second->GetName());
// for subdirs add a rule to build this specific target by name. // for subdirs add a rule to build this specific target by name.

View File

@ -896,6 +896,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
lg->AddGeneratorTarget(autogenTarget, gt); lg->AddGeneratorTarget(autogenTarget, gt);
lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
// Set target folder // Set target folder
const char* autogenFolder = makefile->GetState() const char* autogenFolder = makefile->GetState()

View File

@ -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.

View File

@ -5,4 +5,7 @@ enable_language(CXX)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") 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)

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -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)

View File

@ -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.$

View File

@ -2,6 +2,8 @@ include(RunCMake)
run_cmake(PropertyTypo) run_cmake(PropertyTypo)
run_cmake(CMP0063-OLD) 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-WARN-no)
run_cmake(CMP0063-NEW) run_cmake(CMP0063-NEW)