diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2007-02-23 14:46:27 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2007-02-23 14:46:27 (GMT) |
commit | 8ad343093179035fa8ad9136e8e8f72fc3804dd2 (patch) | |
tree | 35c34abc3af73da857cffea26f0c4eeb2872369b | |
parent | 440bbf08711e9a784f90f1d2541e5d204807161a (diff) | |
download | CMake-8ad343093179035fa8ad9136e8e8f72fc3804dd2.zip CMake-8ad343093179035fa8ad9136e8e8f72fc3804dd2.tar.gz CMake-8ad343093179035fa8ad9136e8e8f72fc3804dd2.tar.bz2 |
ENH: Make EXCLUDE_FROM_ALL a target and directory properties. Also, make IsInAll use EXCLUDE_FROM_ALL. Also, enable the test that tests this
-rw-r--r-- | Source/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 11 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 8 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmTarget.h | 6 |
6 files changed, 40 insertions, 17 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 4346752..213c631 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 ec1554e..3c27da9 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 e9c58d4..1b8f124 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<std::string> StartDirectoryComponents; std::vector<std::string> HomeOutputDirectoryComponents; std::vector<std::string> StartOutputDirectoryComponents; - bool ExcludeFromAll; cmLocalGenerator* Parent; std::vector<cmLocalGenerator*> Children; std::map<cmStdString, cmStdString> LanguageToIncludeFlags; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 60929ef..4b81edb 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 b542d4d..5feb3bc 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 de216f3..e12870b 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); |