From 7d76de4403480dc607261c5a1067a24c667faeeb Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 29 Mar 2002 14:20:32 -0500 Subject: [PATCH] make sure ; expansion is done in all commands --- Source/cmAbstractFilesCommand.cxx | 7 +- Source/cmAddCustomCommandCommand.cxx | 6 +- Source/cmAddCustomTargetCommand.cxx | 6 +- Source/cmAddDefinitionsCommand.cxx | 7 +- Source/cmAddDependenciesCommand.cxx | 8 ++- Source/cmAddTestCommand.cxx | 8 +-- Source/cmCableClassSetCommand.cxx | 6 +- Source/cmCableWrapTclCommand.cxx | 8 ++- Source/cmCommands.cxx | 2 - Source/cmCreateTestSourceList.cxx | 2 +- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmFindFileCommand.cxx | 7 +- Source/cmFindLibraryCommand.cxx | 6 +- Source/cmFindPathCommand.cxx | 7 +- Source/cmFindProgramCommand.cxx | 8 ++- Source/cmGetSourceFilePropertyCommand.cxx | 4 +- Source/cmGetSourceFilePropertyCommand.h | 2 +- Source/cmIncludeDirectoryCommand.cxx | 6 +- Source/cmInstallFilesCommand.cxx | 6 +- Source/cmInstallProgramsCommand.cxx | 6 +- Source/cmInstallTargetsCommand.cxx | 6 +- Source/cmLinkDirectoriesCommand.cxx | 7 +- Source/cmLoadCacheCommand.cxx | 8 ++- Source/cmMakeDirectoryCommand.cxx | 2 +- Source/cmMarkAsAdvancedCommand.cxx | 7 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmProjectCommand.cxx | 2 +- Source/cmQTWrapCPPCommand.cxx | 6 +- Source/cmQTWrapUICommand.cxx | 6 +- Source/cmSetSourceFilesPropertiesCommand.cxx | 12 ++-- Source/cmSetSourceFilesPropertiesCommand.h | 2 +- Source/cmSiteNameCommand.cxx | 2 +- Source/cmSourceFilesCommand.cxx | 8 ++- Source/cmSourceFilesFlagsCommand.cxx | 49 -------------- Source/cmSourceFilesFlagsCommand.h | 64 ------------------- Source/cmSourceFilesRemoveCommand.cxx | 7 +- Source/cmSubdirCommand.cxx | 7 +- Source/cmSystemTools.cxx | 11 +++- Source/cmSystemTools.h | 3 +- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.h | 4 +- Source/cmUtilitySourceCommand.cxx | 8 ++- Source/cmVTKMakeInstantiatorCommand.cxx | 8 ++- Source/cmVTKWrapJavaCommand.cxx | 6 +- Source/cmVTKWrapPythonCommand.cxx | 6 +- Source/cmVTKWrapTclCommand.cxx | 7 +- Source/cmVariableRequiresCommand.cxx | 2 +- Source/cmWrapExcludeFilesCommand.cxx | 7 +- Tests/Complex/Executable/CMakeLists.txt | 2 +- Tests/Complex/Executable/complex.cxx | 13 ++++ Tests/Complex/Library/CMakeLists.txt | 22 ++----- Tests/Complex/Library/file2.cxx | 19 ++++++ Tests/Complex/Library/file2.h | 1 + .../Executable/CMakeLists.txt | 2 +- Tests/ComplexOneConfig/Executable/complex.cxx | 13 ++++ Tests/ComplexOneConfig/Library/CMakeLists.txt | 22 ++----- Tests/ComplexOneConfig/Library/file2.cxx | 19 ++++++ Tests/ComplexOneConfig/Library/file2.h | 1 + .../Executable/CMakeLists.txt | 2 +- .../Executable/complex.cxx | 13 ++++ .../Library/CMakeLists.txt | 22 ++----- Tests/ComplexRelativePaths/Library/file2.cxx | 19 ++++++ Tests/ComplexRelativePaths/Library/file2.h | 1 + 63 files changed, 283 insertions(+), 263 deletions(-) delete mode 100644 Source/cmSourceFilesFlagsCommand.cxx delete mode 100644 Source/cmSourceFilesFlagsCommand.h diff --git a/Source/cmAbstractFilesCommand.cxx b/Source/cmAbstractFilesCommand.cxx index 32a6237e1..2bfb6b5d9 100644 --- a/Source/cmAbstractFilesCommand.cxx +++ b/Source/cmAbstractFilesCommand.cxx @@ -17,13 +17,16 @@ #include "cmAbstractFilesCommand.h" // cmAbstractFilesCommand -bool cmAbstractFilesCommand::InitialPass(std::vector const& args) +bool cmAbstractFilesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + bool ret = true; std::string m = "could not find source file(s):\n"; diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index eb5396185..845ff2486 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -18,17 +18,19 @@ // cmAddCustomCommandCommand -bool cmAddCustomCommandCommand::InitialPass(std::vector const& args) +bool cmAddCustomCommandCommand::InitialPass(std::vector const& argsIn) { /* Let's complain at the end of this function about the lack of a particular arg. For the moment, let's say that SOURCE, COMMAND, TARGET are always required. */ - if (args.size() < 6) + if (argsIn.size() < 6) { this->SetError("called with wrong number of arguments."); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); std::string source, command, target; std::vector command_args, depends, outputs; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index d03d4d29e..070fc4aed 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -17,15 +17,17 @@ #include "cmAddCustomTargetCommand.h" // cmAddCustomTargetCommand -bool cmAddCustomTargetCommand::InitialPass(std::vector const& args) +bool cmAddCustomTargetCommand::InitialPass(std::vector const& argsIn) { bool all = false; - if(args.size() < 2 ) + if(argsIn.size() < 2 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // all target option std::string arguments; diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx index 70846dfdb..75f84eaf8 100644 --- a/Source/cmAddDefinitionsCommand.cxx +++ b/Source/cmAddDefinitionsCommand.cxx @@ -17,13 +17,16 @@ #include "cmAddDefinitionsCommand.h" // cmAddDefinitionsCommand -bool cmAddDefinitionsCommand::InitialPass(std::vector const& args) +bool cmAddDefinitionsCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index c4cc00ced..de444eabc 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -18,14 +18,16 @@ #include "cmCacheManager.h" // cmDependenciesCommand -bool cmAddDependenciesCommand::InitialPass(std::vector const& args) +bool cmAddDependenciesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2 ) + if(argsIn.size() < 2 ) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + std::string target_name = args[0]; cmTargets &tgts = m_Makefile->GetTargets(); diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index 37271fd7e..ff4e3ba64 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -34,13 +34,7 @@ bool cmAddTestCommand::InitialPass(std::vector const& args) // also expand any CMake variables m_Args.erase(m_Args.begin(), m_Args.end()); - std::string temp; - for (std::vector::const_iterator j = args.begin(); - j != args.end(); ++j) - { - m_Args.push_back(*j); - } - + cmSystemTools::ExpandListArguments(args, m_Args); return true; } diff --git a/Source/cmCableClassSetCommand.cxx b/Source/cmCableClassSetCommand.cxx index ae6ddcf8b..fca7eba78 100644 --- a/Source/cmCableClassSetCommand.cxx +++ b/Source/cmCableClassSetCommand.cxx @@ -19,13 +19,15 @@ #include "cmTarget.h" // cmCableClassSetCommand -bool cmCableClassSetCommand::InitialPass(std::vector const& args) +bool cmCableClassSetCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2) + if(argsIn.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // The first argument is the name of the set. std::vector::const_iterator arg = args.begin(); diff --git a/Source/cmCableWrapTclCommand.cxx b/Source/cmCableWrapTclCommand.cxx index 21750a1fa..96076b785 100644 --- a/Source/cmCableWrapTclCommand.cxx +++ b/Source/cmCableWrapTclCommand.cxx @@ -122,17 +122,19 @@ cmCableWrapTclCommand::~cmCableWrapTclCommand() // cmCableWrapTclCommand -bool cmCableWrapTclCommand::InitialPass(std::vector const& args) +bool cmCableWrapTclCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2) + if(argsIn.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Prepare to iterate through the arguments. std::vector::const_iterator arg = args.begin(); - + // The first argument is the name of the target. m_TargetName = *arg++; diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 26e9f0657..7aa991e60 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -68,7 +68,6 @@ #include "cmSetSourceFilesPropertiesCommand.cxx" #include "cmSiteNameCommand.cxx" #include "cmSourceFilesCommand.cxx" -#include "cmSourceFilesFlagsCommand.cxx" #include "cmSourceFilesRemoveCommand.cxx" #include "cmSourceGroupCommand.cxx" #include "cmSubdirCommand.cxx" @@ -137,7 +136,6 @@ void GetPredefinedCommands(std::list& commands) commands.push_back(new cmSetSourceFilesPropertiesCommand); commands.push_back(new cmSiteNameCommand); commands.push_back(new cmSourceFilesCommand); - commands.push_back(new cmSourceFilesFlagsCommand); commands.push_back(new cmSourceFilesRemoveCommand); commands.push_back(new cmSourceGroupCommand); commands.push_back(new cmSubdirCommand); diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index d9c33be03..87b4bdea7 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -27,7 +27,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector const& argsIn) } std::vector args; - cmSystemTools::ExpandListArguments(argsIn, args, true); + cmSystemTools::ExpandListArguments(argsIn, args); std::vector::iterator i = args.begin(); diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 6eb728097..3ac91ec24 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -19,7 +19,7 @@ // cmFLTKWrapUICommand bool cmFLTKWrapUICommand::InitialPass(std::vector const& args) { - if(args.size() < 2 ) + if(args.size() != 2 ) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx index 0e4099759..22464a0cf 100644 --- a/Source/cmFindFileCommand.cxx +++ b/Source/cmFindFileCommand.cxx @@ -31,12 +31,12 @@ bool cmFindFileCommand::InitialPass(std::vector const& argsIn) std::string helpString = "Where can the "; helpString += argsIn[1] + " file be found"; size_t size = argsIn.size(); - std::vector args; + std::vector argst; for(unsigned int j = 0; j < size; ++j) { if(argsIn[j] != "DOC") { - args.push_back(argsIn[j]); + argst.push_back(argsIn[j]); } else { @@ -47,6 +47,9 @@ bool cmFindFileCommand::InitialPass(std::vector const& argsIn) break; } } + std::vector args; + cmSystemTools::ExpandListArguments(argst, args); + std::vector::const_iterator i = args.begin(); // Use the first argument as the name of something to be defined const char* define = (*i).c_str(); diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 9368ff635..5bd68de60 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -27,12 +27,12 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn) } std::string helpString; size_t size = argsIn.size(); - std::vector args; + std::vector argst; for(unsigned int j = 0; j < size; ++j) { if(argsIn[j] != "DOC") { - args.push_back(argsIn[j]); + argst.push_back(argsIn[j]); } else { @@ -43,6 +43,8 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn) break; } } + std::vector args; + cmSystemTools::ExpandListArguments(argst, args); std::vector path; std::vector names; diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 0de65021e..f4b2474aa 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -30,13 +30,13 @@ bool cmFindPathCommand::InitialPass(std::vector const& argsIn) // already, if so use that value and don't look for the program std::string helpString = "What is the path where the file "; helpString += argsIn[1] + " can be found"; - std::vector args; + std::vector argst; size_t size = argsIn.size(); for(unsigned int j = 0; j < size; ++j) { if(argsIn[j] != "DOC") { - args.push_back(argsIn[j]); + argst.push_back(argsIn[j]); } else { @@ -47,6 +47,9 @@ bool cmFindPathCommand::InitialPass(std::vector const& argsIn) break; } } + std::vector args; + cmSystemTools::ExpandListArguments(argst, args); + const char* cacheValue = m_Makefile->GetDefinition(args[0].c_str()); if(cacheValue && strcmp(cacheValue, "NOTFOUND")) diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index f614ed5a2..3d2489915 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -30,12 +30,12 @@ bool cmFindProgramCommand::InitialPass(std::vector const& argsIn) } std::string doc = "Path to a program."; size_t size = argsIn.size(); - std::vector args; + std::vector argst; for(unsigned int j = 0; j < size; ++j) { if(argsIn[j] != "DOC") { - args.push_back(argsIn[j]); + argst.push_back(argsIn[j]); } else { @@ -46,6 +46,10 @@ bool cmFindProgramCommand::InitialPass(std::vector const& argsIn) break; } } + std::vector args; + cmSystemTools::ExpandListArguments(argst, args); + + std::vector::iterator i = args.begin(); // Use the first argument as the name of something to be defined const char* define = (*i).c_str(); diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 12a6dcd63..df8ca491b 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -20,7 +20,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(std::vector const& args) { - if(args.size() < 3 ) + if(args.size() != 3 ) { this->SetError("called with incorrect number of arguments"); return false; @@ -38,7 +38,7 @@ bool cmGetSourceFilePropertyCommand::InitialPass(std::vector const& { m_Makefile->AddDefinition(var, sf->GetWrapExclude()); } - if(args[2] == "FLAGS") + if(args[2] == "COMPILE_FLAGS") { m_Makefile->AddDefinition(var, sf->GetCompileFlags()); } diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 483bd42b6..456f5ea9c 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -53,7 +53,7 @@ public: virtual const char* GetFullDocumentation() { return - "GET_SOURCE_FILE_PROPERTY(VAR file [ABSTRACT|WRAP_EXCLUDE|FLAGS]) " + "GET_SOURCE_FILE_PROPERTY(VAR file [ABSTRACT|WRAP_EXCLUDE|COMPILE_FLAGS]) " "Get a property from a source file. The value of the property is stored " "in the variable VAR."; } diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 2984808ad..48d51fd9b 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -17,13 +17,15 @@ #include "cmIncludeDirectoryCommand.h" #include "cmCacheManager.h" // cmIncludeDirectoryCommand -bool cmIncludeDirectoryCommand::InitialPass(std::vector const& args) +bool cmIncludeDirectoryCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); std::vector::const_iterator i = args.begin(); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 87cdd388f..31aa5fa07 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -18,13 +18,15 @@ #include "cmCacheManager.h" // cmExecutableCommand -bool cmInstallFilesCommand::InitialPass(std::vector const& args) +bool cmInstallFilesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2) + if(argsIn.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Create an INSTALL_FILES target specifically for this path. m_TargetName = "INSTALL_FILES_"+args[0]; diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index d805e30f7..6049bb0cb 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -18,13 +18,15 @@ #include "cmCacheManager.h" // cmExecutableCommand -bool cmInstallProgramsCommand::InitialPass(std::vector const& args) +bool cmInstallProgramsCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2) + if(argsIn.size() < 2) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Create an INSTALL_PROGRAMS target specifically for this path. m_TargetName = "INSTALL_PROGRAMS_"+args[0]; diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 88cd17c43..e7e1bf6ed 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -18,13 +18,15 @@ #include "cmCacheManager.h" // cmExecutableCommand -bool cmInstallTargetsCommand::InitialPass(std::vector const& args) +bool cmInstallTargetsCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 2 ) + if(argsIn.size() < 2 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); cmTargets &tgts = m_Makefile->GetTargets(); std::vector::const_iterator s = args.begin(); diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index bf868b8a2..468fda239 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -17,13 +17,16 @@ #include "cmLinkDirectoriesCommand.h" // cmLinkDirectoriesCommand -bool cmLinkDirectoriesCommand::InitialPass(std::vector const& args) +bool cmLinkDirectoriesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 988cec530..aa9186a70 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -18,13 +18,15 @@ // cmLoadcacheCommand -bool cmLoadCacheCommand::InitialPass(std::vector const& args) +bool cmLoadCacheCommand::InitialPass(std::vector const& argsIn) { - if (args.size()< 1) + if (argsIn.size()< 1) { this->SetError("called with wrong number of arguments."); } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + // Cache entries to be excluded from the import list. // If this set is empty, all cache entries are brought in // and they can not be overridden. diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index 4f7f8e765..6d919c75e 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -20,7 +20,7 @@ // cmMakeDirectoryCommand bool cmMakeDirectoryCommand::InitialPass(std::vector const& args) { - if(args.size() < 1 ) + if(args.size() != 1 ) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 24c9b9646..30a401cf7 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -17,13 +17,16 @@ #include "cmMarkAsAdvancedCommand.h" // cmMarkAsAdvancedCommand -bool cmMarkAsAdvancedCommand::InitialPass(std::vector const& args) +bool cmMarkAsAdvancedCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + unsigned int i =0; const char* value = "1"; bool overwrite = false; diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 8fcba47a9..68a88626f 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -159,7 +159,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) // cmOutputRequiredFilesCommand bool cmOutputRequiredFilesCommand::InitialPass(std::vector const& args) { - if(args.size() < 2 ) + if(args.size() != 2 ) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 83fcc47e8..197bcccb8 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -19,7 +19,7 @@ // cmProjectCommand bool cmProjectCommand::InitialPass(std::vector const& args) { - if(args.size() < 1 || args.size() > 1) + if(args.size() != 1 ) { this->SetError("PROJECT called with incorrect number of arguments"); return false; diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 0a82c266d..df1ba0c34 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -17,13 +17,15 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector const& args) +bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 3 ) + if(argsIn.size() < 3 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index b34e36d3a..957816daa 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -17,13 +17,15 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector const& args) +bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 4 ) + if(argsIn.size() < 4 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 06581eb36..f065b455a 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -18,14 +18,16 @@ // cmSetSourceFilesPropertiesCommand bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector const& - args) + argsIn) { - if(args.size() < 2 ) + if(argsIn.size() < 2 ) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + std::vector::const_iterator j; // first collect up all the flags that need to be set on the file bool abstract = false; @@ -46,7 +48,7 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector con { generated = true; } - else if(*j == "FLAGS") + else if(*j == "COMPILE_FLAGS") { ++j; if(j == args.end()) @@ -61,7 +63,7 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector con for(j = args.begin(); j != args.end(); ++j) { // at the sign of the first property exit the loop - if(*j == "ABSTRACT" || *j == "WRAP_EXCLUDE" || *j == "FLAGS") + if(*j == "ABSTRACT" || *j == "WRAP_EXCLUDE" || *j == "COMPILE_FLAGS") { break; } diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 7ad974b7c..cad2b4e3c 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -53,7 +53,7 @@ public: virtual const char* GetFullDocumentation() { return - "SET_SOURCE_FILES_PROPERTIES(flags file1 file2 [ABSTRACT|WRAP_EXCLUDE|GENERATED|FLAGS] [flags]) " + "SET_SOURCE_FILES_PROPERTIES(flags file1 file2 [ABSTRACT|WRAP_EXCLUDE|GENERATED|COMPILE_FLAGS] [flags]) " "Set properties on a file. The syntax for the command is to list all the files you want " "to change, and then provide the values you want to set next."; } diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 2cd18ce6d..f91599a1f 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -19,7 +19,7 @@ // cmSiteNameCommand bool cmSiteNameCommand::InitialPass(std::vector const& args) { - if(args.size() < 1 ) + if(args.size() != 1 ) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmSourceFilesCommand.cxx b/Source/cmSourceFilesCommand.cxx index b5825519a..274083334 100644 --- a/Source/cmSourceFilesCommand.cxx +++ b/Source/cmSourceFilesCommand.cxx @@ -17,14 +17,16 @@ #include "cmSourceFilesCommand.h" // cmSourceFilesCommand -bool cmSourceFilesCommand::InitialPass(std::vector const& args) +bool cmSourceFilesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + std::string name = args[0]; int generated = 0; diff --git a/Source/cmSourceFilesFlagsCommand.cxx b/Source/cmSourceFilesFlagsCommand.cxx deleted file mode 100644 index 81a911438..000000000 --- a/Source/cmSourceFilesFlagsCommand.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - Copyright (c) 2002 Insight Consortium. All rights reserved. - See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmSourceFilesFlagsCommand.h" - -// cmSourceFilesFlagsCommand -bool cmSourceFilesFlagsCommand::InitialPass(std::vector const& - args) -{ - if(args.size() < 2 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - - std::vector::const_iterator j = args.begin(); - std::string flags = *j; - ++j; - for(;j != args.end(); ++j) - { - cmSourceFile* sf = m_Makefile->GetSource(j->c_str()); - if(sf) - { - sf->SetCompileFlags(flags.c_str()); - } - else - { - std::string m = "could not find source file "; - m += *j; - this->SetError(m.c_str()); - return false; - } - } - return true; -} - diff --git a/Source/cmSourceFilesFlagsCommand.h b/Source/cmSourceFilesFlagsCommand.h deleted file mode 100644 index a85230d23..000000000 --- a/Source/cmSourceFilesFlagsCommand.h +++ /dev/null @@ -1,64 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile$ - Language: C++ - Date: $Date$ - Version: $Revision$ - - Copyright (c) 2002 Insight Consortium. All rights reserved. - See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 cmSourceFilesFlagsCommand_h -#define cmSourceFilesFlagsCommand_h - -#include "cmStandardIncludes.h" -#include "cmCommand.h" - -class cmSourceFilesFlagsCommand : public cmCommand -{ -public: - virtual cmCommand* Clone() - { - return new cmSourceFilesFlagsCommand; - } - - /** - * This is called when the command is first encountered in - * the input file. - */ - virtual bool InitialPass(std::vector const& args); - - /** - * The name of the command as specified in CMakeList.txt. - */ - virtual const char* GetName() { return "SOURCE_FILES_FLAGS";} - - /** - * Succinct documentation. - */ - virtual const char* GetTerseDocumentation() - { - return "Set compile flags for a specific list of files."; - } - - /** - * Longer documentation. - */ - virtual const char* GetFullDocumentation() - { - return - "SOURCE_FILES_FLAGS(flags file1 file2 ..)"; - } - - cmTypeMacro(cmSourceFilesFlagsCommand, cmCommand); -}; - - - -#endif diff --git a/Source/cmSourceFilesRemoveCommand.cxx b/Source/cmSourceFilesRemoveCommand.cxx index ebd3c9d2a..b9d3fe1dd 100644 --- a/Source/cmSourceFilesRemoveCommand.cxx +++ b/Source/cmSourceFilesRemoveCommand.cxx @@ -17,13 +17,16 @@ #include "cmSourceFilesRemoveCommand.h" // cmSourceFilesRemoveCommand -bool cmSourceFilesRemoveCommand::InitialPass(std::vector const& args) +bool cmSourceFilesRemoveCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + int generated = 0; for(std::vector::const_iterator i = (args.begin() + 1); i != args.end(); ++i) diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index f5825b403..88e362d4c 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -17,13 +17,16 @@ #include "cmSubdirCommand.h" // cmSubdirCommand -bool cmSubdirCommand::InitialPass(std::vector const& args) +bool cmSubdirCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 6f34c8ea4..2e330fced 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1045,10 +1045,16 @@ bool RunCommandViaSystem(const char* command, cmSystemTools::RemoveFile(tempFile.c_str()); return false; } + bool multiLine = false; while(fin) { fin.getline(buffer, BUFFER_SIZE); output += buffer; + if(multiLine) + { + output += "\n"; + } + multiLine = true; } fin.close(); cmSystemTools::RemoveFile(tempFile.c_str()); @@ -1609,8 +1615,7 @@ void cmSystemTools::GlobDirs(const char *fullPath, void cmSystemTools::ExpandListArguments(std::vector const& arguments, - std::vector& newargs, - bool ignore_empty) + std::vector& newargs) { std::vector::const_iterator i; for(i = arguments.begin();i != arguments.end(); ++i) @@ -1631,7 +1636,7 @@ void cmSystemTools::ExpandListArguments(std::vector const& argument { len = i->size()-start; } - if (ignore_empty == false || len > 0) + if (len > 0) { newargs.push_back(i->substr(start, len)); } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b9f684200..9cbd62a11 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -48,8 +48,7 @@ public: * containing the expanded versions of all arguments in argsIn. */ static void ExpandListArguments(std::vector const& argsIn, - std::vector& argsOut, - bool ignore_empty = false); + std::vector& argsOut); /** * Look for and replace registry values in a string diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index a762fa14e..413d8a4b3 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -23,7 +23,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector const& args) // expected two arguments: // arguement one: the full path to gl_mangle.h // arguement two : directory for output of edited headers - if(args.size() < 2) + if(args.size() != 2) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 19b635b64..a96d3c4b1 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -62,8 +62,8 @@ public: virtual const char* GetFullDocumentation() { return - "USE_MANGLED_MESA(\"path to mesa includes, should contain gl_mangle.h\"" - " \"directory for output\" )"; + "USE_MANGLED_MESA(PATH_TO_MESA OUTPUT_DIRECTORY)\n" + "The path to mesa includes, should contain gl_mangle.h. "; } protected: diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 6672dbddd..0bcae6538 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -17,14 +17,16 @@ #include "cmUtilitySourceCommand.h" // cmUtilitySourceCommand -bool cmUtilitySourceCommand::InitialPass(std::vector const& args) +bool cmUtilitySourceCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 3) + if(argsIn.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + std::vector::const_iterator arg = args.begin(); // The first argument is the cache entry name. diff --git a/Source/cmVTKMakeInstantiatorCommand.cxx b/Source/cmVTKMakeInstantiatorCommand.cxx index 3294bc4b8..b1c8157e8 100644 --- a/Source/cmVTKMakeInstantiatorCommand.cxx +++ b/Source/cmVTKMakeInstantiatorCommand.cxx @@ -20,14 +20,16 @@ bool cmVTKMakeInstantiatorCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& argsIn) { - if(args.size() < 3) + if(argsIn.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); + m_ClassName = args[0]; std::string outSourceList = args[1]; diff --git a/Source/cmVTKWrapJavaCommand.cxx b/Source/cmVTKWrapJavaCommand.cxx index 49b374e04..84634a2ef 100644 --- a/Source/cmVTKWrapJavaCommand.cxx +++ b/Source/cmVTKWrapJavaCommand.cxx @@ -17,13 +17,15 @@ #include "cmVTKWrapJavaCommand.h" // cmVTKWrapJavaCommand -bool cmVTKWrapJavaCommand::InitialPass(std::vector const& args) +bool cmVTKWrapJavaCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 3 ) + if(argsIn.size() < 3 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program diff --git a/Source/cmVTKWrapPythonCommand.cxx b/Source/cmVTKWrapPythonCommand.cxx index ad595e7e7..7748942e7 100644 --- a/Source/cmVTKWrapPythonCommand.cxx +++ b/Source/cmVTKWrapPythonCommand.cxx @@ -17,13 +17,15 @@ #include "cmVTKWrapPythonCommand.h" // cmVTKWrapPythonCommand -bool cmVTKWrapPythonCommand::InitialPass(std::vector const& args) +bool cmVTKWrapPythonCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 3 ) + if(argsIn.size() < 3 ) { this->SetError("called with incorrect number of arguments"); return false; } + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program diff --git a/Source/cmVTKWrapTclCommand.cxx b/Source/cmVTKWrapTclCommand.cxx index 0f9b52445..f7f0f265c 100644 --- a/Source/cmVTKWrapTclCommand.cxx +++ b/Source/cmVTKWrapTclCommand.cxx @@ -17,14 +17,15 @@ #include "cmVTKWrapTclCommand.h" // cmVTKWrapTclCommand -bool cmVTKWrapTclCommand::InitialPass(std::vector const& args) +bool cmVTKWrapTclCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 3 ) + if(argsIn.size() < 3 ) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); // keep the library name m_LibraryName = args[0]; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 69b01dcf5..6d89c0d44 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -25,7 +25,7 @@ bool cmVariableRequiresCommand::InitialPass(std::vector const& args this->SetError("called with incorrect number of arguments"); return false; } - m_Arguments = args; + cmSystemTools::ExpandListArguments(args, m_Arguments); return true; } diff --git a/Source/cmWrapExcludeFilesCommand.cxx b/Source/cmWrapExcludeFilesCommand.cxx index 153d30e84..9e020d192 100644 --- a/Source/cmWrapExcludeFilesCommand.cxx +++ b/Source/cmWrapExcludeFilesCommand.cxx @@ -17,14 +17,15 @@ #include "cmWrapExcludeFilesCommand.h" // cmWrapExcludeFilesCommand -bool cmWrapExcludeFilesCommand::InitialPass(std::vector const& args) +bool cmWrapExcludeFilesCommand::InitialPass(std::vector const& argsIn) { - if(args.size() < 1 ) + if(argsIn.size() < 1 ) { this->SetError("called with incorrect number of arguments"); return false; } - + std::vector args; + cmSystemTools::ExpandListArguments(argsIn, args); cmMakefile::SourceMap &Classes = m_Makefile->GetSources(); for(std::vector::const_iterator j = args.begin(); j != args.end(); ++j) diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 801c77728..9acd78044 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -1,8 +1,8 @@ # # Create exe. # +SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES") ADD_EXECUTABLE(complex complex) - SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared) TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS}) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index f1fe92db8..54f45e014 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -95,6 +95,11 @@ void TestDir(const char* filename) int main() { +#ifdef SET_SOURCE_FILES_PROPERTIES + cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#else + cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#endif if(sharedFunction() != 1) { cmFailed("Call to sharedFunction from shared library failed."); @@ -121,6 +126,14 @@ int main() { cmPassed("Call to file2 function returned 1."); } + if(PropertyTest() != 1) + { + cmFailed("Call to PropertyTest function from library failed."); + } + else + { + cmPassed("Call to PropertyTest function returned 1."); + } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index 86a75012b..5533d0400 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -25,26 +25,16 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources) # # test SET_SOURCE_FILES_PROPERTIES -SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE FLAGS "-foo -bar") +SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar") GET_SOURCE_FILE_PROPERTY(ISABS nonexisting_file2 ABSTRACT) GET_SOURCE_FILE_PROPERTY(WRAPEX nonexisting_file2 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 FLAGS) +GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 COMPILE_FLAGS) MESSAGE("ISABS = ${ISABS} WRAPEX = ${WRAPEX} FLAGS = ${FLAGS}") -# to force a failed test add a source file that does not exist with -# the name of the failed test -IF(NOT ISABS) - SOURCE_FILES(ISABS IS_ABSTRACT_FailTest) -ENDIF(NOT ISABS) -IF(NOT WRAPEX) - SOURCE_FILES(WRAPEX IS_WRAP_EXCLUDE_FailTest) -ENDIF(NOT WRAPEX) +CONFIGURE_FILE( + ${Complex_SOURCE_DIR}/Library/cmTestLibraryConfigure.h.in + ${Complex_BINARY_DIR}/Library/cmTestLibraryConfigure.h) -IF(FLAGS MATCHES "-foo -bar") - MESSAGE("Flags are set correctly ") -ELSE(FLAGS MATCHES "-foo -bar") - SOURCE_FILES(WRAPEX FLAGS_FailTest) -ENDIF(FLAGS MATCHES "-foo -bar") @@ -52,7 +42,7 @@ SOURCE_FILES(SharedLibrarySources nonexisting_file2) SOURCE_FILES_REMOVE(SharedLibrarySources GENERATED nonexisting_file2) -SET_SOURCE_FILES_PROPERTIES(fileFlags FLAGS "-DEXTRA_FLAG" ) +SET_SOURCE_FILES_PROPERTIES(fileFlags COMPILE_FLAGS "-DEXTRA_FLAG" ) SOURCE_FILES(SharedLibrarySources sharedFile fileFlags) ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources) diff --git a/Tests/Complex/Library/file2.cxx b/Tests/Complex/Library/file2.cxx index 1351669f0..29bc9d8cd 100644 --- a/Tests/Complex/Library/file2.cxx +++ b/Tests/Complex/Library/file2.cxx @@ -1,4 +1,23 @@ +#include +#include + int file2() { return 1; } + +int PropertyTest() +{ + int ret = 1; +#ifndef ISABS + ret = 0; +#endif +#ifndef WRAPEX + ret = 0; +#endif + if(strcmp(FLAGS,"-foo -bar") != 0) + { + ret =0; + } + return ret; +} diff --git a/Tests/Complex/Library/file2.h b/Tests/Complex/Library/file2.h index dea4b80b1..5e0b3158a 100644 --- a/Tests/Complex/Library/file2.h +++ b/Tests/Complex/Library/file2.h @@ -1 +1,2 @@ int file2(); +int PropertyTest(); diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 801c77728..9acd78044 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -1,8 +1,8 @@ # # Create exe. # +SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES") ADD_EXECUTABLE(complex complex) - SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared) TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS}) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index f1fe92db8..54f45e014 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -95,6 +95,11 @@ void TestDir(const char* filename) int main() { +#ifdef SET_SOURCE_FILES_PROPERTIES + cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#else + cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#endif if(sharedFunction() != 1) { cmFailed("Call to sharedFunction from shared library failed."); @@ -121,6 +126,14 @@ int main() { cmPassed("Call to file2 function returned 1."); } + if(PropertyTest() != 1) + { + cmFailed("Call to PropertyTest function from library failed."); + } + else + { + cmPassed("Call to PropertyTest function returned 1."); + } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index 86a75012b..5533d0400 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -25,26 +25,16 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources) # # test SET_SOURCE_FILES_PROPERTIES -SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE FLAGS "-foo -bar") +SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar") GET_SOURCE_FILE_PROPERTY(ISABS nonexisting_file2 ABSTRACT) GET_SOURCE_FILE_PROPERTY(WRAPEX nonexisting_file2 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 FLAGS) +GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 COMPILE_FLAGS) MESSAGE("ISABS = ${ISABS} WRAPEX = ${WRAPEX} FLAGS = ${FLAGS}") -# to force a failed test add a source file that does not exist with -# the name of the failed test -IF(NOT ISABS) - SOURCE_FILES(ISABS IS_ABSTRACT_FailTest) -ENDIF(NOT ISABS) -IF(NOT WRAPEX) - SOURCE_FILES(WRAPEX IS_WRAP_EXCLUDE_FailTest) -ENDIF(NOT WRAPEX) +CONFIGURE_FILE( + ${Complex_SOURCE_DIR}/Library/cmTestLibraryConfigure.h.in + ${Complex_BINARY_DIR}/Library/cmTestLibraryConfigure.h) -IF(FLAGS MATCHES "-foo -bar") - MESSAGE("Flags are set correctly ") -ELSE(FLAGS MATCHES "-foo -bar") - SOURCE_FILES(WRAPEX FLAGS_FailTest) -ENDIF(FLAGS MATCHES "-foo -bar") @@ -52,7 +42,7 @@ SOURCE_FILES(SharedLibrarySources nonexisting_file2) SOURCE_FILES_REMOVE(SharedLibrarySources GENERATED nonexisting_file2) -SET_SOURCE_FILES_PROPERTIES(fileFlags FLAGS "-DEXTRA_FLAG" ) +SET_SOURCE_FILES_PROPERTIES(fileFlags COMPILE_FLAGS "-DEXTRA_FLAG" ) SOURCE_FILES(SharedLibrarySources sharedFile fileFlags) ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources) diff --git a/Tests/ComplexOneConfig/Library/file2.cxx b/Tests/ComplexOneConfig/Library/file2.cxx index 1351669f0..29bc9d8cd 100644 --- a/Tests/ComplexOneConfig/Library/file2.cxx +++ b/Tests/ComplexOneConfig/Library/file2.cxx @@ -1,4 +1,23 @@ +#include +#include + int file2() { return 1; } + +int PropertyTest() +{ + int ret = 1; +#ifndef ISABS + ret = 0; +#endif +#ifndef WRAPEX + ret = 0; +#endif + if(strcmp(FLAGS,"-foo -bar") != 0) + { + ret =0; + } + return ret; +} diff --git a/Tests/ComplexOneConfig/Library/file2.h b/Tests/ComplexOneConfig/Library/file2.h index dea4b80b1..5e0b3158a 100644 --- a/Tests/ComplexOneConfig/Library/file2.h +++ b/Tests/ComplexOneConfig/Library/file2.h @@ -1 +1,2 @@ int file2(); +int PropertyTest(); diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index 801c77728..9acd78044 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -1,8 +1,8 @@ # # Create exe. # +SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES") ADD_EXECUTABLE(complex complex) - SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared) TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS}) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index f1fe92db8..54f45e014 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -95,6 +95,11 @@ void TestDir(const char* filename) int main() { +#ifdef SET_SOURCE_FILES_PROPERTIES + cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#else + cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source"); +#endif if(sharedFunction() != 1) { cmFailed("Call to sharedFunction from shared library failed."); @@ -121,6 +126,14 @@ int main() { cmPassed("Call to file2 function returned 1."); } + if(PropertyTest() != 1) + { + cmFailed("Call to PropertyTest function from library failed."); + } + else + { + cmPassed("Call to PropertyTest function returned 1."); + } // ---------------------------------------------------------------------- // Test ADD_DEFINITIONS diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt index 86a75012b..5533d0400 100644 --- a/Tests/ComplexRelativePaths/Library/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt @@ -25,26 +25,16 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources) # # test SET_SOURCE_FILES_PROPERTIES -SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE FLAGS "-foo -bar") +SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar") GET_SOURCE_FILE_PROPERTY(ISABS nonexisting_file2 ABSTRACT) GET_SOURCE_FILE_PROPERTY(WRAPEX nonexisting_file2 WRAP_EXCLUDE) -GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 FLAGS) +GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 COMPILE_FLAGS) MESSAGE("ISABS = ${ISABS} WRAPEX = ${WRAPEX} FLAGS = ${FLAGS}") -# to force a failed test add a source file that does not exist with -# the name of the failed test -IF(NOT ISABS) - SOURCE_FILES(ISABS IS_ABSTRACT_FailTest) -ENDIF(NOT ISABS) -IF(NOT WRAPEX) - SOURCE_FILES(WRAPEX IS_WRAP_EXCLUDE_FailTest) -ENDIF(NOT WRAPEX) +CONFIGURE_FILE( + ${Complex_SOURCE_DIR}/Library/cmTestLibraryConfigure.h.in + ${Complex_BINARY_DIR}/Library/cmTestLibraryConfigure.h) -IF(FLAGS MATCHES "-foo -bar") - MESSAGE("Flags are set correctly ") -ELSE(FLAGS MATCHES "-foo -bar") - SOURCE_FILES(WRAPEX FLAGS_FailTest) -ENDIF(FLAGS MATCHES "-foo -bar") @@ -52,7 +42,7 @@ SOURCE_FILES(SharedLibrarySources nonexisting_file2) SOURCE_FILES_REMOVE(SharedLibrarySources GENERATED nonexisting_file2) -SET_SOURCE_FILES_PROPERTIES(fileFlags FLAGS "-DEXTRA_FLAG" ) +SET_SOURCE_FILES_PROPERTIES(fileFlags COMPILE_FLAGS "-DEXTRA_FLAG" ) SOURCE_FILES(SharedLibrarySources sharedFile fileFlags) ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources) diff --git a/Tests/ComplexRelativePaths/Library/file2.cxx b/Tests/ComplexRelativePaths/Library/file2.cxx index 1351669f0..29bc9d8cd 100644 --- a/Tests/ComplexRelativePaths/Library/file2.cxx +++ b/Tests/ComplexRelativePaths/Library/file2.cxx @@ -1,4 +1,23 @@ +#include +#include + int file2() { return 1; } + +int PropertyTest() +{ + int ret = 1; +#ifndef ISABS + ret = 0; +#endif +#ifndef WRAPEX + ret = 0; +#endif + if(strcmp(FLAGS,"-foo -bar") != 0) + { + ret =0; + } + return ret; +} diff --git a/Tests/ComplexRelativePaths/Library/file2.h b/Tests/ComplexRelativePaths/Library/file2.h index dea4b80b1..5e0b3158a 100644 --- a/Tests/ComplexRelativePaths/Library/file2.h +++ b/Tests/ComplexRelativePaths/Library/file2.h @@ -1 +1,2 @@ int file2(); +int PropertyTest();