Introduce "generator expressions" to add_test()
[cmake.git] / Source / cmInstallScriptGenerator.cxx
blob35d1284fe27d573331add14c699bb672cf7cf7a7
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmInstallScriptGenerator.cxx,v $
5 Language: C++
6 Date: $Date: 2007-10-15 11:08:10 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 "cmInstallScriptGenerator.h"
19 //----------------------------------------------------------------------------
20 cmInstallScriptGenerator
21 ::cmInstallScriptGenerator(const char* script, bool code,
22 const char* component) :
23 cmInstallGenerator(0, std::vector<std::string>(), component),
24 Script(script), Code(code)
28 //----------------------------------------------------------------------------
29 cmInstallScriptGenerator
30 ::~cmInstallScriptGenerator()
34 //----------------------------------------------------------------------------
35 void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
37 Indent indent;
38 std::string component_test =
39 this->CreateComponentTest(this->Component.c_str());
40 os << indent << "IF(" << component_test << ")\n";
42 if(this->Code)
44 os << indent.Next() << this->Script << "\n";
46 else
48 os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n";
51 os << indent << "ENDIF(" << component_test << ")\n\n";