View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0007507 | CMake | CMake | public | 2008-08-20 02:04 | 2008-08-25 10:32 | ||||
Reporter | Philip Lowman | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | feature | Reproducibility | N/A | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0007507: [PATCH] A scripted means to remove cache variables | ||||||||
Description | Attached is a patch which includes a new unset() command that removes both normal and cache variables. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | cmake-cvs+unset.diff [^] (18,891 bytes) 2008-08-20 02:04 [Show Content] [Hide Content]diff --exclude=CVS -urN CMake.orig/Docs/cmake-syntax.vim CMake/Docs/cmake-syntax.vim --- CMake.orig/Docs/cmake-syntax.vim 2008-01-16 11:53:53.000000000 -0500 +++ CMake/Docs/cmake-syntax.vim 2008-08-20 01:34:36.000000000 -0400 @@ -3,7 +3,7 @@ " Program: CMake - Cross-Platform Makefile Generator " Module: $RCSfile: cmake-syntax.vim,v $ " Language: VIM -" Date: $Date: 2008-01-16 16:53:53 $ +" Date: $Date: 2008/01/16 16:53:53 $ " Version: $Revision: 1.9 $ " " ============================================================================= @@ -12,7 +12,7 @@ " Language: CMake " Author: Andy Cedilnik <andy.cedilnik@kitware.com> " Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: $Date: 2008-01-16 16:53:53 $ +" Last Change: $Date: 2008/01/16 16:53:53 $ " Version: $Revision: 1.9 $ " " Licence: The CMake license applies to this file. See @@ -41,7 +41,7 @@ syn region cmakeArguments start=/(/ end=/)/ \ contains=ALLBUT,cmakeArguments,cmakeTodo syn keyword cmakeSystemVariables - \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 + \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 syn keyword cmakeOperators \ ABSOLUTE AND BOOL CACHE COMMAND DEFINED DOC EQUAL EXISTS EXT FALSE GREATER INTERNAL LESS MATCHES NAME NAMES NAME_WE NOT OFF ON OR PATH PATHS PROGRAM STREQUAL STRGREATER STRING STRLESS TRUE \ contained @@ -50,7 +50,7 @@ " The keywords are generated as: cmake --help-command-list | tr "\n" " " syn keyword cmakeStatement - \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE + \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ nextgroup=cmakeArguments syn keyword cmakeTodo \ TODO FIXME XXX diff --exclude=CVS -urN CMake.orig/Source/cmake.cxx CMake/Source/cmake.cxx --- CMake.orig/Source/cmake.cxx 2008-08-19 13:31:21.000000000 -0400 +++ CMake/Source/cmake.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -437,7 +437,7 @@ currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(currentEntry->c_str()); + this->CacheManager->RemoveCacheEntry(currentEntry->c_str(), true); } } else if(arg.find("-C",0) == 0) @@ -2145,8 +2145,8 @@ { // We must have a bad generator selection. Wipe the cache entry so the // user can select another. - this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); - this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR", true); + this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR", true); } // only save the cache if there were no fatal errors if ( !this->ScriptMode ) diff --exclude=CVS -urN CMake.orig/Source/cmBootstrapCommands.cxx CMake/Source/cmBootstrapCommands.cxx --- CMake.orig/Source/cmBootstrapCommands.cxx 2008-07-07 15:07:54.000000000 -0400 +++ CMake/Source/cmBootstrapCommands.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -93,6 +93,7 @@ #include "cmTargetLinkLibrariesCommand.cxx" #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" +#include "cmUnsetCommand.cxx" void GetBootstrapCommands(std::list<cmCommand*>& commands) { @@ -163,4 +164,5 @@ commands.push_back(new cmTargetLinkLibrariesCommand); commands.push_back(new cmTryCompileCommand); commands.push_back(new cmTryRunCommand); + commands.push_back(new cmUnsetCommand); } diff --exclude=CVS -urN CMake.orig/Source/cmCacheManager.cxx CMake/Source/cmCacheManager.cxx --- CMake.orig/Source/cmCacheManager.cxx 2008-01-29 17:30:48.000000000 -0500 +++ CMake/Source/cmCacheManager.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -3,7 +3,7 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCacheManager.cxx,v $ Language: C++ - Date: $Date: 2008-01-29 22:30:48 $ + Date: $Date: 2008/01/29 22:30:48 $ Version: $Revision: 1.100 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. @@ -707,14 +707,14 @@ } } -void cmCacheManager::RemoveCacheEntry(const char* key) +void cmCacheManager::RemoveCacheEntry(const char* key, bool warn) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) { this->Cache.erase(i); } - else + else if (warn) { std::cerr << "Failed to remove entry:" << key << std::endl; } diff --exclude=CVS -urN CMake.orig/Source/cmCacheManager.h CMake/Source/cmCacheManager.h --- CMake.orig/Source/cmCacheManager.h 2008-03-07 11:43:47.000000000 -0500 +++ CMake/Source/cmCacheManager.h 2008-08-20 01:34:59.000000000 -0400 @@ -125,7 +125,7 @@ cmCacheManager::CacheIterator GetCacheIterator(const char *key=0); ///! Remove an entry from the cache - void RemoveCacheEntry(const char* key); + void RemoveCacheEntry(const char* key, bool warn); ///! Get the number of entries in the cache int GetSize() { diff --exclude=CVS -urN CMake.orig/Source/cmMakefile.cxx CMake/Source/cmMakefile.cxx --- CMake.orig/Source/cmMakefile.cxx 2008-08-19 10:28:22.000000000 -0400 +++ CMake/Source/cmMakefile.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -1648,6 +1648,11 @@ #endif } +void cmMakefile::RemoveCacheDefinition(const char* name) +{ + this->GetCacheManager()->RemoveCacheEntry(name, false); +} + void cmMakefile::SetProjectName(const char* p) { this->ProjectName = p; diff --exclude=CVS -urN CMake.orig/Source/cmMakefile.h CMake/Source/cmMakefile.h --- CMake.orig/Source/cmMakefile.h 2008-08-18 16:29:00.000000000 -0400 +++ CMake/Source/cmMakefile.h 2008-08-20 01:34:59.000000000 -0400 @@ -278,6 +278,8 @@ * for cache entries, and will only affect the current makefile. */ void RemoveDefinition(const char* name); + ///! Remove a definition from this makefile and the global cmake cache. + void RemoveCacheDefinition(const char* name); /** * Specify the name of the project for this build. diff --exclude=CVS -urN CMake.orig/Source/cmUnsetCommand.cxx CMake/Source/cmUnsetCommand.cxx --- CMake.orig/Source/cmUnsetCommand.cxx 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Source/cmUnsetCommand.cxx 2008-08-20 01:34:12.000000000 -0400 @@ -0,0 +1,53 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmSetCommand.cxx,v $ + Language: C++ + Date: $Date: 2008-03-13 17:52:49 $ + Version: $Revision: 1.33 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmUnsetCommand.h" + +// cmUnsetCommand +bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) +{ + if(args.size() != 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + // watch for ENV signatures + const char* variable = args[0].c_str(); // VAR is always first + if (!strncmp(variable,"ENV{",4) && strlen(variable) > 5) + { + // what is the variable name + char *varName = new char [strlen(variable)]; + strncpy(varName,variable+4,strlen(variable)-5); + varName[strlen(variable)-5] = '\0'; + +#ifdef CMAKE_BUILD_WITH_CMAKE + cmSystemTools::UnsetEnv(varName); +#endif + return true; + } + + // UNSET (VAR) + if (args.size() == 1) + { + this->Makefile->RemoveDefinition(args[0].c_str()); + this->Makefile->RemoveCacheDefinition(args[0].c_str()); + return true; + } + + return false; +} + diff --exclude=CVS -urN CMake.orig/Source/cmUnsetCommand.h CMake/Source/cmUnsetCommand.h --- CMake.orig/Source/cmUnsetCommand.h 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Source/cmUnsetCommand.h 2008-08-20 01:34:12.000000000 -0400 @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmSetCommand.h,v $ + Language: C++ + Date: $Date: 2008/01/23 15:27:59 $ + Version: $Revision: 1.20 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmUnsetCommand_h +#define cmUnsetCommand_h + +#include "cmCommand.h" + +/** \class cmUnsetCommand + * \brief Unset a CMAKE variable + * + * cmUnsetCommand unsets or removes a variable. + */ +class cmUnsetCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmUnsetCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "unset";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Unset a variable or cache variable causing it to become undefined."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " unset(<variable>)\n" + "Removes the specified variable or cache variable causing it to become undefined."; + } + + cmTypeMacro(cmUnsetCommand, cmCommand); +}; + + + +#endif diff --exclude=CVS -urN CMake.orig/Source/CursesDialog/cmCursesMainForm.cxx CMake/Source/CursesDialog/cmCursesMainForm.cxx --- CMake.orig/Source/CursesDialog/cmCursesMainForm.cxx 2008-03-07 16:32:09.000000000 -0500 +++ CMake/Source/CursesDialog/cmCursesMainForm.cxx 2008-08-20 01:35:22.000000000 -0400 @@ -1139,7 +1139,7 @@ field_userptr(this->Fields[findex-2])); if ( lbl ) { - this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); + this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue(), true); std::string nextVal; if (nextCur) diff --exclude=CVS -urN CMake.orig/Source/FLTKDialog/FLTKPropertyItemRow.cxx CMake/Source/FLTKDialog/FLTKPropertyItemRow.cxx --- CMake.orig/Source/FLTKDialog/FLTKPropertyItemRow.cxx 2007-08-21 16:21:09.000000000 -0400 +++ CMake/Source/FLTKDialog/FLTKPropertyItemRow.cxx 2008-08-20 01:36:25.000000000 -0400 @@ -3,7 +3,7 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: FLTKPropertyItemRow.cxx,v $ Language: C++ - Date: $Date: 2007-08-21 20:21:09 $ + Date: $Date: 2007/08/21 20:21:09 $ Version: $Revision: 1.20 $ Copyright (c) 2002 Insight Consortium. All rights reserved. @@ -238,7 +238,7 @@ if( answer == 1 ) { // Remove the entry from the cache - m_CMakeSetup->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(propertyName); + m_CMakeSetup->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(propertyName, true); // Get the parent: Fl_Tile that manages the whole row in the GUI Fl_Group * parentGroup = dynamic_cast<Fl_Group *>(button->parent()); // Get the grandParent: Fl_Pack with the property list diff --exclude=CVS -urN CMake.orig/Source/FLTKDialog/FLTKPropertyList.cxx CMake/Source/FLTKDialog/FLTKPropertyList.cxx --- CMake.orig/Source/FLTKDialog/FLTKPropertyList.cxx 2007-08-21 16:21:09.000000000 -0400 +++ CMake/Source/FLTKDialog/FLTKPropertyList.cxx 2008-08-20 01:36:25.000000000 -0400 @@ -3,7 +3,7 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: FLTKPropertyList.cxx,v $ Language: C++ - Date: $Date: 2007-08-21 20:21:09 $ + Date: $Date: 2007/08/21 20:21:09 $ Version: $Revision: 1.10 $ Copyright (c) 2002 Insight Consortium. All rights reserved. @@ -139,7 +139,7 @@ for(int i =0; i < c; ++i) { PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(0); -// cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str()); +// cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str(), true); m_PropertyItems.erase(pItem); delete pItem; } diff --exclude=CVS -urN CMake.orig/Source/MFCDialog/PropertyList.cpp CMake/Source/MFCDialog/PropertyList.cpp --- CMake.orig/Source/MFCDialog/PropertyList.cpp 2007-03-05 09:51:13.000000000 -0500 +++ CMake/Source/MFCDialog/PropertyList.cpp 2008-08-20 01:36:58.000000000 -0400 @@ -729,7 +729,7 @@ return; } CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel); - m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName); + m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName, true); m_PropertyItems.erase(pItem); delete pItem; this->DeleteString(m_curSel); diff --exclude=CVS -urN CMake.orig/Source/QtDialog/QCMake.cxx CMake/Source/QtDialog/QCMake.cxx --- CMake.orig/Source/QtDialog/QCMake.cxx 2008-05-15 19:21:01.000000000 -0400 +++ CMake/Source/QtDialog/QCMake.cxx 2008-08-20 01:37:08.000000000 -0400 @@ -209,7 +209,7 @@ // remove some properites foreach(QString s, toremove) { - cachem->RemoveCacheEntry(s.toAscii().data()); + cachem->RemoveCacheEntry(s.toAscii().data(), true); } // add some new properites diff --exclude=CVS -urN CMake.orig/Source/WXDialog/PropertyList.cpp CMake/Source/WXDialog/PropertyList.cpp --- CMake.orig/Source/WXDialog/PropertyList.cpp 2005-06-30 15:54:14.000000000 -0400 +++ CMake/Source/WXDialog/PropertyList.cpp 2008-08-20 01:37:30.000000000 -0400 @@ -3,7 +3,7 @@ Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake Module: $RCSfile: PropertyList.cpp,v $ Language: C++ - Date: $Date: 2005-06-30 19:54:14 $ + Date: $Date: 2005/06/30 19:54:14 $ Version: $Revision: 1.1 $ Author: Jorgen Bodde @@ -486,7 +486,7 @@ return; } wxPropertyItem* pItem = (wxPropertyItem*) GetItemDataPtr(m_curSel); - m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName); + m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName, true); m_PropertyItems.erase(pItem); delete pItem; this->DeleteString(m_curSel); diff --exclude=CVS -urN CMake.orig/Tests/Unset/CMakeLists.txt CMake/Tests/Unset/CMakeLists.txt --- CMake.orig/Tests/Unset/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Tests/Unset/CMakeLists.txt 2008-08-20 01:08:04.000000000 -0400 @@ -0,0 +1,31 @@ +project(Unset) + +# Local variable + +set(x 42) +if(NOT x EQUAL 42) + message(FATAL_ERROR "x!=42") +endif(NOT x EQUAL 42) + +if(NOT DEFINED x) + message(FATAL_ERROR "x should be defined!") +endif(NOT DEFINED x) + +unset(x) +if(DEFINED x) + message(FATAL_ERROR "x should be undefined now!") +endif(DEFINED x) + +# Cache variable + +set(BAR "test" CACHE STRING "documentation") +if(NOT DEFINED BAR) + message(FATAL_ERROR "BAR not defined") +endif(NOT DEFINED BAR) + +unset(BAR) +if(DEFINED BAR) + message(FATAL_ERROR "BAR still defined") +endif(DEFINED BAR) + +add_executable(Unset unset.cc) diff --exclude=CVS -urN CMake.orig/Tests/Unset/unset.cc CMake/Tests/Unset/unset.cc --- CMake.orig/Tests/Unset/unset.cc 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Tests/Unset/unset.cc 2008-08-20 01:08:04.000000000 -0400 @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} cmake-cvs+unset2.diff [^] (21,655 bytes) 2008-08-22 00:38 [Show Content] [Hide Content] diff --exclude=CVS -Nur CMake.orig/Docs/cmake-syntax.vim CMake/Docs/cmake-syntax.vim --- CMake.orig/Docs/cmake-syntax.vim 2008-01-16 11:53:53.000000000 -0500 +++ CMake/Docs/cmake-syntax.vim 2008-08-20 01:34:36.000000000 -0400 @@ -3,7 +3,7 @@ " Program: CMake - Cross-Platform Makefile Generator " Module: $RCSfile: cmake-syntax.vim,v $ " Language: VIM -" Date: $Date: 2008-01-16 16:53:53 $ +" Date: $Date: 2008/01/16 16:53:53 $ " Version: $Revision: 1.9 $ " " ============================================================================= @@ -12,7 +12,7 @@ " Language: CMake " Author: Andy Cedilnik <andy.cedilnik@kitware.com> " Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: $Date: 2008-01-16 16:53:53 $ +" Last Change: $Date: 2008/01/16 16:53:53 $ " Version: $Revision: 1.9 $ " " Licence: The CMake license applies to this file. See @@ -41,7 +41,7 @@ syn region cmakeArguments start=/(/ end=/)/ \ contains=ALLBUT,cmakeArguments,cmakeTodo syn keyword cmakeSystemVariables - \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 + \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 syn keyword cmakeOperators \ ABSOLUTE AND BOOL CACHE COMMAND DEFINED DOC EQUAL EXISTS EXT FALSE GREATER INTERNAL LESS MATCHES NAME NAMES NAME_WE NOT OFF ON OR PATH PATHS PROGRAM STREQUAL STRGREATER STRING STRLESS TRUE \ contained @@ -50,7 +50,7 @@ " The keywords are generated as: cmake --help-command-list | tr "\n" " " syn keyword cmakeStatement - \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE + \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ nextgroup=cmakeArguments syn keyword cmakeTodo \ TODO FIXME XXX diff --exclude=CVS -Nur CMake.orig/Source/cmake.cxx CMake/Source/cmake.cxx --- CMake.orig/Source/cmake.cxx 2008-08-19 13:31:21.000000000 -0400 +++ CMake/Source/cmake.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -437,7 +437,7 @@ currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(currentEntry->c_str()); + this->CacheManager->RemoveCacheEntry(currentEntry->c_str(), true); } } else if(arg.find("-C",0) == 0) @@ -2145,8 +2145,8 @@ { // We must have a bad generator selection. Wipe the cache entry so the // user can select another. - this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); - this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR", true); + this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR", true); } // only save the cache if there were no fatal errors if ( !this->ScriptMode ) diff --exclude=CVS -Nur CMake.orig/Source/cmBootstrapCommands.cxx CMake/Source/cmBootstrapCommands.cxx --- CMake.orig/Source/cmBootstrapCommands.cxx 2008-07-07 15:07:54.000000000 -0400 +++ CMake/Source/cmBootstrapCommands.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -93,6 +93,7 @@ #include "cmTargetLinkLibrariesCommand.cxx" #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" +#include "cmUnsetCommand.cxx" void GetBootstrapCommands(std::list<cmCommand*>& commands) { @@ -163,4 +164,5 @@ commands.push_back(new cmTargetLinkLibrariesCommand); commands.push_back(new cmTryCompileCommand); commands.push_back(new cmTryRunCommand); + commands.push_back(new cmUnsetCommand); } diff --exclude=CVS -Nur CMake.orig/Source/cmCacheManager.cxx CMake/Source/cmCacheManager.cxx --- CMake.orig/Source/cmCacheManager.cxx 2008-01-29 17:30:48.000000000 -0500 +++ CMake/Source/cmCacheManager.cxx 2008-08-20 01:34:59.000000000 -0400 @@ -3,7 +3,7 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCacheManager.cxx,v $ Language: C++ - Date: $Date: 2008-01-29 22:30:48 $ + Date: $Date: 2008/01/29 22:30:48 $ Version: $Revision: 1.100 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. @@ -707,14 +707,14 @@ } } -void cmCacheManager::RemoveCacheEntry(const char* key) +void cmCacheManager::RemoveCacheEntry(const char* key, bool warn) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) { this->Cache.erase(i); } - else + else if (warn) { std::cerr << "Failed to remove entry:" << key << std::endl; } diff --exclude=CVS -Nur CMake.orig/Source/cmCacheManager.h CMake/Source/cmCacheManager.h --- CMake.orig/Source/cmCacheManager.h 2008-03-07 11:43:47.000000000 -0500 +++ CMake/Source/cmCacheManager.h 2008-08-20 01:34:59.000000000 -0400 @@ -125,7 +125,7 @@ cmCacheManager::CacheIterator GetCacheIterator(const char *key=0); ///! Remove an entry from the cache - void RemoveCacheEntry(const char* key); + void RemoveCacheEntry(const char* key, bool warn); ///! Get the number of entries in the cache int GetSize() { diff --exclude=CVS -Nur CMake.orig/Source/cmMakefile.cxx CMake/Source/cmMakefile.cxx --- CMake.orig/Source/cmMakefile.cxx 2008-08-19 10:28:22.000000000 -0400 +++ CMake/Source/cmMakefile.cxx 2008-08-21 23:35:58.000000000 -0400 @@ -1648,6 +1648,11 @@ #endif } +void cmMakefile::RemoveCacheDefinition(const char* name) +{ + this->GetCacheManager()->RemoveCacheEntry(name, false); +} + void cmMakefile::SetProjectName(const char* p) { this->ProjectName = p; diff --exclude=CVS -Nur CMake.orig/Source/cmMakefile.h CMake/Source/cmMakefile.h --- CMake.orig/Source/cmMakefile.h 2008-08-18 16:29:00.000000000 -0400 +++ CMake/Source/cmMakefile.h 2008-08-21 23:34:20.000000000 -0400 @@ -278,6 +278,8 @@ * for cache entries, and will only affect the current makefile. */ void RemoveDefinition(const char* name); + ///! Remove a definition from the cache. + void RemoveCacheDefinition(const char* name); /** * Specify the name of the project for this build. diff --exclude=CVS -Nur CMake.orig/Source/cmSetCommand.h CMake/Source/cmSetCommand.h --- CMake.orig/Source/cmSetCommand.h 2008-01-23 10:27:59.000000000 -0500 +++ CMake/Source/cmSetCommand.h 2008-08-22 00:02:23.000000000 -0400 @@ -87,8 +87,9 @@ "above the current scope. Each new directory or function creates a new " "scope. This command will set the value of a variable into the parent " "directory or calling function (whichever is applicable to the case at " - "hand) If VALUE is not specified then the variable is removed from the " - "parent scope.\n" + "hand)\n" + "If VALUE is not specified then the variable is removed from the " + "current scope. See also: the unset() command.\n" " set(<variable> <value1> ... <valueN>)\n" "In this case <variable> is set to a semicolon separated list of " "values.\n" diff --exclude=CVS -Nur CMake.orig/Source/cmUnsetCommand.cxx CMake/Source/cmUnsetCommand.cxx --- CMake.orig/Source/cmUnsetCommand.cxx 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Source/cmUnsetCommand.cxx 2008-08-21 23:54:25.000000000 -0400 @@ -0,0 +1,63 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmSetCommand.cxx,v $ + Language: C++ + Date: $Date: 2008-03-13 17:52:49 $ + Version: $Revision: 1.33 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmUnsetCommand.h" + +// cmUnsetCommand +bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) +{ + if(args.size() < 1 || args.size() > 2) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + const char* variable = args[0].c_str(); + + // unset(ENV{VAR}) + if (!strncmp(variable,"ENV{",4) && strlen(variable) > 5) + { + // what is the variable name + char *envVarName = new char [strlen(variable)]; + strncpy(envVarName,variable+4,strlen(variable)-5); + envVarName[strlen(variable)-5] = '\0'; + +#ifdef CMAKE_BUILD_WITH_CMAKE + cmSystemTools::UnsetEnv(envVarName); +#endif + delete[] envVarName; + return true; + } + // unset(VAR) + else if (args.size() == 1) + { + this->Makefile->RemoveDefinition(variable); + return true; + } + // unset(VAR CACHE) + else if ((args.size() == 2) && (args[1] == "CACHE")) + { + this->Makefile->RemoveCacheDefinition(variable); + return true; + } + // ERROR: second argument isn't CACHE + else + { + this->SetError("unset() called with an invalid second argument"); + return false; + } +} + diff --exclude=CVS -Nur CMake.orig/Source/cmUnsetCommand.h CMake/Source/cmUnsetCommand.h --- CMake.orig/Source/cmUnsetCommand.h 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Source/cmUnsetCommand.h 2008-08-22 00:03:56.000000000 -0400 @@ -0,0 +1,83 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile: cmSetCommand.h,v $ + Language: C++ + Date: $Date: 2008/01/23 15:27:59 $ + Version: $Revision: 1.20 $ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmUnsetCommand_h +#define cmUnsetCommand_h + +#include "cmCommand.h" + +/** \class cmUnsetCommand + * \brief Unset a CMAKE variable + * + * cmUnsetCommand unsets or removes a variable. + */ +class cmUnsetCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmUnsetCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "unset";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Unset a variable, cache variable, or environment variable, causing it to become undefined."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " unset(<variable> [CACHE])\n" + "Removes the specified variable if it exists causing it to become undefined. " + "If CACHE is present then a cache variable with the specified name is removed if " + "it exists.\n" + "<variable> can be an environment variable such as:\n" + " unset( ENV{LD_LIBRARY_PATH} )\n" + "in which case the environment variable will be unset if it exists."; + } + + cmTypeMacro(cmUnsetCommand, cmCommand); +}; + + + +#endif diff --exclude=CVS -Nur CMake.orig/Source/CursesDialog/cmCursesMainForm.cxx CMake/Source/CursesDialog/cmCursesMainForm.cxx --- CMake.orig/Source/CursesDialog/cmCursesMainForm.cxx 2008-03-07 16:32:09.000000000 -0500 +++ CMake/Source/CursesDialog/cmCursesMainForm.cxx 2008-08-20 01:35:22.000000000 -0400 @@ -1139,7 +1139,7 @@ field_userptr(this->Fields[findex-2])); if ( lbl ) { - this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); + this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue(), true); std::string nextVal; if (nextCur) diff --exclude=CVS -Nur CMake.orig/Source/CursesDialog/cmCursesMainForm.h CMake/Source/CursesDialog/cmCursesMainForm.h --- CMake.orig/Source/CursesDialog/cmCursesMainForm.h 2006-03-16 10:44:55.000000000 -0500 +++ CMake/Source/CursesDialog/cmCursesMainForm.h 2008-08-20 01:35:22.000000000 -0400 @@ -3,7 +3,7 @@ Program: CMake - Cross-Platform Makefile Generator Module: $RCSfile: cmCursesMainForm.h,v $ Language: C++ - Date: $Date: 2006-03-16 15:44:55 $ + Date: $Date: 2006/03/16 15:44:55 $ Version: $Revision: 1.24 $ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. diff --exclude=CVS -Nur CMake.orig/Source/FLTKDialog/FLTKPropertyItemRow.cxx CMake/Source/FLTKDialog/FLTKPropertyItemRow.cxx --- CMake.orig/Source/FLTKDialog/FLTKPropertyItemRow.cxx 2007-08-21 16:21:09.000000000 -0400 +++ CMake/Source/FLTKDialog/FLTKPropertyItemRow.cxx 2008-08-20 01:36:25.000000000 -0400 @@ -3,7 +3,7 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: FLTKPropertyItemRow.cxx,v $ Language: C++ - Date: $Date: 2007-08-21 20:21:09 $ + Date: $Date: 2007/08/21 20:21:09 $ Version: $Revision: 1.20 $ Copyright (c) 2002 Insight Consortium. All rights reserved. @@ -238,7 +238,7 @@ if( answer == 1 ) { // Remove the entry from the cache - m_CMakeSetup->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(propertyName); + m_CMakeSetup->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(propertyName, true); // Get the parent: Fl_Tile that manages the whole row in the GUI Fl_Group * parentGroup = dynamic_cast<Fl_Group *>(button->parent()); // Get the grandParent: Fl_Pack with the property list diff --exclude=CVS -Nur CMake.orig/Source/FLTKDialog/FLTKPropertyList.cxx CMake/Source/FLTKDialog/FLTKPropertyList.cxx --- CMake.orig/Source/FLTKDialog/FLTKPropertyList.cxx 2007-08-21 16:21:09.000000000 -0400 +++ CMake/Source/FLTKDialog/FLTKPropertyList.cxx 2008-08-20 01:36:25.000000000 -0400 @@ -3,7 +3,7 @@ Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: FLTKPropertyList.cxx,v $ Language: C++ - Date: $Date: 2007-08-21 20:21:09 $ + Date: $Date: 2007/08/21 20:21:09 $ Version: $Revision: 1.10 $ Copyright (c) 2002 Insight Consortium. All rights reserved. @@ -139,7 +139,7 @@ for(int i =0; i < c; ++i) { PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(0); -// cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str()); +// cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str(), true); m_PropertyItems.erase(pItem); delete pItem; } diff --exclude=CVS -Nur CMake.orig/Source/MFCDialog/PropertyList.cpp CMake/Source/MFCDialog/PropertyList.cpp --- CMake.orig/Source/MFCDialog/PropertyList.cpp 2007-03-05 09:51:13.000000000 -0500 +++ CMake/Source/MFCDialog/PropertyList.cpp 2008-08-20 01:36:58.000000000 -0400 @@ -729,7 +729,7 @@ return; } CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel); - m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName); + m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName, true); m_PropertyItems.erase(pItem); delete pItem; this->DeleteString(m_curSel); diff --exclude=CVS -Nur CMake.orig/Source/QtDialog/QCMake.cxx CMake/Source/QtDialog/QCMake.cxx --- CMake.orig/Source/QtDialog/QCMake.cxx 2008-05-15 19:21:01.000000000 -0400 +++ CMake/Source/QtDialog/QCMake.cxx 2008-08-20 01:37:08.000000000 -0400 @@ -209,7 +209,7 @@ // remove some properites foreach(QString s, toremove) { - cachem->RemoveCacheEntry(s.toAscii().data()); + cachem->RemoveCacheEntry(s.toAscii().data(), true); } // add some new properites diff --exclude=CVS -Nur CMake.orig/Source/WXDialog/PropertyList.cpp CMake/Source/WXDialog/PropertyList.cpp --- CMake.orig/Source/WXDialog/PropertyList.cpp 2005-06-30 15:54:14.000000000 -0400 +++ CMake/Source/WXDialog/PropertyList.cpp 2008-08-20 01:37:30.000000000 -0400 @@ -3,7 +3,7 @@ Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake Module: $RCSfile: PropertyList.cpp,v $ Language: C++ - Date: $Date: 2005-06-30 19:54:14 $ + Date: $Date: 2005/06/30 19:54:14 $ Version: $Revision: 1.1 $ Author: Jorgen Bodde @@ -486,7 +486,7 @@ return; } wxPropertyItem* pItem = (wxPropertyItem*) GetItemDataPtr(m_curSel); - m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName); + m_CMakeSetupDialog->GetCMakeInstance()->GetCacheManager()->RemoveCacheEntry(pItem->m_propName, true); m_PropertyItems.erase(pItem); delete pItem; this->DeleteString(m_curSel); diff --exclude=CVS -Nur CMake.orig/Tests/CMakeLists.txt CMake/Tests/CMakeLists.txt --- CMake.orig/Tests/CMakeLists.txt 2008-08-19 11:43:57.000000000 -0400 +++ CMake/Tests/CMakeLists.txt 2008-08-22 00:11:29.000000000 -0400 @@ -94,6 +94,7 @@ ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(Preprocess Preprocess) ADD_TEST_MACRO(ExportImport ExportImport) + ADD_TEST_MACRO(Unset Unset) # If we are running right now with a UnixMakefiles based generator, diff --exclude=CVS -Nur CMake.orig/Tests/Unset/CMakeLists.txt CMake/Tests/Unset/CMakeLists.txt --- CMake.orig/Tests/Unset/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Tests/Unset/CMakeLists.txt 2008-08-22 00:14:40.000000000 -0400 @@ -0,0 +1,40 @@ +project(Unset) + +# Local variable +set(x 42) +if(NOT x EQUAL 42) + message(FATAL_ERROR "x!=42") +endif(NOT x EQUAL 42) + +if(NOT DEFINED x) + message(FATAL_ERROR "x should be defined!") +endif(NOT DEFINED x) + +unset(x) +if(DEFINED x) + message(FATAL_ERROR "x should be undefined now!") +endif(DEFINED x) + +# Local variable test unset via set() +set(x 43) +if(NOT x EQUAL 43) + message(FATAL_ERROR "x!=43") +endif(NOT x EQUAL 43) +set(x) +if(DEFINED x) + message(FATAL_ERROR "x should be undefined now!") +endif(DEFINED x) + +# Cache variable +set(BAR "test" CACHE STRING "documentation") +if(NOT DEFINED BAR) + message(FATAL_ERROR "BAR not defined") +endif(NOT DEFINED BAR) + +unset(BAR CACHE) +if(DEFINED BAR) + message(FATAL_ERROR "BAR still defined") +endif(DEFINED BAR) + + +add_executable(Unset unset.cc) diff --exclude=CVS -Nur CMake.orig/Tests/Unset/unset.cc CMake/Tests/Unset/unset.cc --- CMake.orig/Tests/Unset/unset.cc 1969-12-31 19:00:00.000000000 -0500 +++ CMake/Tests/Unset/unset.cc 2008-08-20 01:08:04.000000000 -0400 @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} | ||||||||
Relationships | |
Relationships |
Notes | |
(0013114) Bill Hoffman (manager) 2008-08-20 09:57 |
Please bring this up on the cmake mailing list for discussion. |
(0013152) Philip Lowman (developer) 2008-08-22 00:40 |
Uploaded a new version as per discussion on mailing list. Test code is included as well. |
(0013173) Brad King (manager) 2008-08-25 10:31 |
Applied, with a few modifications. Thanks for the patch. /cvsroot/CMake/CMake/Docs/cmake-syntax.vim,v <-- Docs/cmake-syntax.vim new revision: 1.10; previous revision: 1.9 /cvsroot/CMake/CMake/Source/cmBootstrapCommands.cxx,v <-- Source/cmBootstrapCommands.cxx new revision: 1.29; previous revision: 1.28 /cvsroot/CMake/CMake/Source/cmCacheManager.cxx,v <-- Source/cmCacheManager.cxx new revision: 1.101; previous revision: 1.100 /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v <-- Source/cmMakefile.cxx new revision: 1.481; previous revision: 1.480 /cvsroot/CMake/CMake/Source/cmMakefile.h,v <-- Source/cmMakefile.h new revision: 1.235; previous revision: 1.234 /cvsroot/CMake/CMake/Source/cmSetCommand.h,v <-- Source/cmSetCommand.h new revision: 1.21; previous revision: 1.20 /cvsroot/CMake/CMake/Source/cmUnsetCommand.cxx,v <-- Source/cmUnsetCommand.cxx initial revision: 1.1 /cvsroot/CMake/CMake/Source/cmUnsetCommand.h,v <-- Source/cmUnsetCommand.h initial revision: 1.1 /cvsroot/CMake/CMake/Tests/CMakeLists.txt,v <-- Tests/CMakeLists.txt new revision: 1.65; previous revision: 1.64 /cvsroot/CMake/CMake/Tests/Unset/CMakeLists.txt,v <-- Tests/Unset/CMakeLists.txt initial revision: 1.1 /cvsroot/CMake/CMake/Tests/Unset/unset.cc,v <-- Tests/Unset/unset.cc initial revision: 1.1 |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-08-20 02:04 | Philip Lowman | New Issue | |
2008-08-20 02:04 | Philip Lowman | File Added: cmake-cvs+unset.diff | |
2008-08-20 09:57 | Bill Hoffman | Status | new => assigned |
2008-08-20 09:57 | Bill Hoffman | Assigned To | => Bill Hoffman |
2008-08-20 09:57 | Bill Hoffman | Note Added: 0013114 | |
2008-08-22 00:38 | Philip Lowman | File Added: cmake-cvs+unset2.diff | |
2008-08-22 00:40 | Philip Lowman | Note Added: 0013152 | |
2008-08-25 10:20 | Brad King | Assigned To | Bill Hoffman => Brad King |
2008-08-25 10:31 | Brad King | Note Added: 0013173 | |
2008-08-25 10:32 | Brad King | Status | assigned => closed |
2008-08-25 10:32 | Brad King | Resolution | open => fixed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |