From 8ad343093179035fa8ad9136e8e8f72fc3804dd2 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 23 Feb 2007 09:46:27 -0500 Subject: [PATCH] ENH: Make EXCLUDE_FROM_ALL a target and directory properties. Also, make IsInAll use EXCLUDE_FROM_ALL. Also, enable the test that tests this --- Source/CMakeLists.txt | 13 +++++++++++++ Source/cmLocalGenerator.cxx | 11 ++++++++++- Source/cmLocalGenerator.h | 11 ++--------- Source/cmMakefile.cxx | 8 ++++++++ Source/cmTarget.cxx | 8 ++++---- Source/cmTarget.h | 6 +++--- 6 files changed, 40 insertions(+), 17 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 434675223..213c63138 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -545,6 +545,19 @@ IF(BUILD_TESTING) --build-two-config --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} # --build-and-test # "${CMake_SOURCE_DIR}/Tests/SameName" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ec1554ebf..3c27da92a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -36,7 +36,6 @@ cmLocalGenerator::cmLocalGenerator() { this->Makefile = new cmMakefile; this->Makefile->SetLocalGenerator(this); - this->ExcludeFromAll = false; this->Parent = 0; this->WindowsShell = false; this->WindowsVSIDE = false; @@ -2407,3 +2406,13 @@ std::string cmLocalGenerator::GetSourceObjectName(cmSourceFile& sf) { 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"); +} diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index e9c58d42c..1b8f12481 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -114,14 +114,8 @@ public: std::string ConvertToOptionallyRelativeOutputPath(const char* remote); // flag to determine if this project should be included in a parent project - bool GetExcludeAll() - { - return this->ExcludeFromAll; - } - void SetExcludeAll(bool b) - { - this->ExcludeFromAll = b; - } + bool GetExcludeAll(); + void SetExcludeAll(bool b); ///! set/get the parent generator cmLocalGenerator* GetParent(){return this->Parent;} @@ -281,7 +275,6 @@ protected: std::vector StartDirectoryComponents; std::vector HomeOutputDirectoryComponents; std::vector StartOutputDirectoryComponents; - bool ExcludeFromAll; cmLocalGenerator* Parent; std::vector Children; std::map LanguageToIncludeFlags; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 60929efc3..4b81edbce 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2745,4 +2745,12 @@ void cmMakefile::DefineProperties(cmake *cm) "A cmake file that will be included when ctest is run.", "If you specify TEST_INCLUDE_FILE, that file will be " "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."); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b542d4da6..5feb3bc1e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -117,10 +117,10 @@ void cmTarget::DefineProperties(cmake *cm) "(such as \".lib\") on an import library name."); cm->DefineProperty - ("IN_ALL", cmProperty::TARGET, - "Is this target part of the all target.", - "A property on a target that indicates if the target is included as " - "part of the default build target. If it is, then with a Makefile " + ("EXCLUDE_FROM_ALL", cmProperty::TARGET, + "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."); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index de216f35a..e12870b96 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -60,10 +60,10 @@ public: /** * Indicate whether the target is part of the all target */ - bool IsInAll() { return this->GetPropertyAsBool("IN_ALL"); } - bool GetInAll() { return this->GetPropertyAsBool("IN_ALL"); } + bool IsInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } + bool GetInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } 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 void SetMakefile(cmMakefile *mf);