ENH: Make EXCLUDE_FROM_ALL a target and directory properties. Also, make IsInAll use EXCLUDE_FROM_ALL. Also, enable the test that tests this

This commit is contained in:
Andy Cedilnik 2007-02-23 09:46:27 -05:00
parent 440bbf0871
commit 8ad3430931
6 changed files with 40 additions and 17 deletions

View File

@ -545,6 +545,19 @@ IF(BUILD_TESTING)
--build-two-config --build-two-config
--test-command simple) --test-command simple)
ADD_TEST(SimpleExclude ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SimpleExclude"
"${CMake_BINARY_DIR}/Tests/SimpleExclude"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-project SimpleExclude
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-two-config
--test-command "${CMAKE_COMMAND}"
"-DCONFIGURATION=\${CTEST_CONFIGURATION_TYPE}"
-P "${CMAKE_BINARY_DIR}/Tests/SimpleExclude/run.cmake"
)
# ADD_TEST(SameName ${CMAKE_CTEST_COMMAND} # ADD_TEST(SameName ${CMAKE_CTEST_COMMAND}
# --build-and-test # --build-and-test
# "${CMake_SOURCE_DIR}/Tests/SameName" # "${CMake_SOURCE_DIR}/Tests/SameName"

View File

@ -36,7 +36,6 @@ cmLocalGenerator::cmLocalGenerator()
{ {
this->Makefile = new cmMakefile; this->Makefile = new cmMakefile;
this->Makefile->SetLocalGenerator(this); this->Makefile->SetLocalGenerator(this);
this->ExcludeFromAll = false;
this->Parent = 0; this->Parent = 0;
this->WindowsShell = false; this->WindowsShell = false;
this->WindowsVSIDE = false; this->WindowsVSIDE = false;
@ -2407,3 +2406,13 @@ std::string cmLocalGenerator::GetSourceObjectName(cmSourceFile& sf)
{ {
return sf.GetSourceName(); return sf.GetSourceName();
} }
bool cmLocalGenerator::GetExcludeAll()
{
return this->Makefile->GetPropertyAsBool("EXCLUDE_FROM_ALL");
}
void cmLocalGenerator::SetExcludeAll(bool b)
{
this->Makefile->SetProperty("EXCLUDE_FROM_ALL", b?"TRUE":"FALSE");
}

View File

@ -114,14 +114,8 @@ public:
std::string ConvertToOptionallyRelativeOutputPath(const char* remote); std::string ConvertToOptionallyRelativeOutputPath(const char* remote);
// flag to determine if this project should be included in a parent project // flag to determine if this project should be included in a parent project
bool GetExcludeAll() bool GetExcludeAll();
{ void SetExcludeAll(bool b);
return this->ExcludeFromAll;
}
void SetExcludeAll(bool b)
{
this->ExcludeFromAll = b;
}
///! set/get the parent generator ///! set/get the parent generator
cmLocalGenerator* GetParent(){return this->Parent;} cmLocalGenerator* GetParent(){return this->Parent;}
@ -281,7 +275,6 @@ protected:
std::vector<std::string> StartDirectoryComponents; std::vector<std::string> StartDirectoryComponents;
std::vector<std::string> HomeOutputDirectoryComponents; std::vector<std::string> HomeOutputDirectoryComponents;
std::vector<std::string> StartOutputDirectoryComponents; std::vector<std::string> StartOutputDirectoryComponents;
bool ExcludeFromAll;
cmLocalGenerator* Parent; cmLocalGenerator* Parent;
std::vector<cmLocalGenerator*> Children; std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> LanguageToIncludeFlags; std::map<cmStdString, cmStdString> LanguageToIncludeFlags;

View File

@ -2745,4 +2745,12 @@ void cmMakefile::DefineProperties(cmake *cm)
"A cmake file that will be included when ctest is run.", "A cmake file that will be included when ctest is run.",
"If you specify TEST_INCLUDE_FILE, that file will be " "If you specify TEST_INCLUDE_FILE, that file will be "
"included and processed when ctest is run on the directory."); "included and processed when ctest is run on the directory.");
cm->DefineProperty
("EXCLUDE_FROM_ALL", cmProperty::DIRECTORY,
"Exclude the target from the all target.",
"A property on a target that indicates if the target is excluded "
"from the default build target. If it is not, then with a Makefile "
"for example typing make will couse this target to be built as well. "
"The same concept applies to the default build of other generators.");
} }

View File

@ -117,10 +117,10 @@ void cmTarget::DefineProperties(cmake *cm)
"(such as \".lib\") on an import library name."); "(such as \".lib\") on an import library name.");
cm->DefineProperty cm->DefineProperty
("IN_ALL", cmProperty::TARGET, ("EXCLUDE_FROM_ALL", cmProperty::TARGET,
"Is this target part of the all target.", "Exclude the target from the all target.",
"A property on a target that indicates if the target is included as " "A property on a target that indicates if the target is excluded "
"part of the default build target. If it is, then with a Makefile " "from the default build target. If it is not, then with a Makefile "
"for example typing make will couse this target to be built as well. " "for example typing make will couse this target to be built as well. "
"The same concept applies to the default build of other generators."); "The same concept applies to the default build of other generators.");

View File

@ -60,10 +60,10 @@ public:
/** /**
* Indicate whether the target is part of the all target * Indicate whether the target is part of the all target
*/ */
bool IsInAll() { return this->GetPropertyAsBool("IN_ALL"); } bool IsInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); }
bool GetInAll() { return this->GetPropertyAsBool("IN_ALL"); } bool GetInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); }
void SetInAll(bool f) { void SetInAll(bool f) {
this->SetProperty("IN_ALL", (f) ?"TRUE" : "FALSE"); } this->SetProperty("EXCLUDE_FROM_ALL", (f) ?"FALSE" : "TRUE"); }
///! Set the cmMakefile that owns this target ///! Set the cmMakefile that owns this target
void SetMakefile(cmMakefile *mf); void SetMakefile(cmMakefile *mf);