ENH: mark some vars as advanced (and resort the list)
[cmake.git] / Source / cmWrapExcludeFilesCommand.cxx
blobc4398656c87ab3cbce26e9e2d7cec6b34852c149
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmWrapExcludeFilesCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-08-16 15:17:59 $
7 Version: $Revision: 1.12 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmWrapExcludeFilesCommand.h"
19 // cmWrapExcludeFilesCommand
20 bool cmWrapExcludeFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
22 const char* versionValue
23 = m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
24 if (versionValue && atof(versionValue) > 1.2)
26 this->SetError("The WRAP_EXCLUDE_FILES command has been deprecated in CMake version 1.4. You should use the SET_SOURCE_FILES_PROPERTIES command instead.\n");
27 return false;
30 if(argsIn.size() < 1 )
32 this->SetError("called with incorrect number of arguments");
33 return false;
35 std::vector<std::string> args;
36 m_Makefile->ExpandSourceListArguments(argsIn, args, 0);
38 for(std::vector<std::string>::const_iterator j = args.begin();
39 j != args.end(); ++j)
41 // if the file is already in the makefile just set properites on it
42 cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
43 if(sf)
45 sf->SetProperty("WRAP_EXCLUDE","1");
47 // if file is not already in the makefile, then add it
48 else
50 std::string newfile = *j;
51 cmSourceFile file;
52 std::string path = cmSystemTools::GetFilenamePath(newfile);
53 // set the flags
54 file.SetProperty("WRAP_EXCLUDE","1");
55 // if this is a full path then
56 if((path.size() && path[0] == '/') ||
57 (path.size() > 1 && path[1] == ':'))
59 file.SetName(cmSystemTools::GetFilenameName(newfile.c_str()).c_str(),
60 path.c_str(),
61 m_Makefile->GetSourceExtensions(),
62 m_Makefile->GetHeaderExtensions());
64 else
66 file.SetName(newfile.c_str(), m_Makefile->GetCurrentDirectory(),
67 m_Makefile->GetSourceExtensions(),
68 m_Makefile->GetHeaderExtensions());
70 // add the source file to the makefile
71 m_Makefile->AddSource(file);
74 return true;