summaryrefslogtreecommitdiffstats
path: root/Source/cmXMLParser.cxx
blob: 7ef6d44293e6e652ff466582697316c6ecd943b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*=========================================================================

  Program:   CMake - Cross-Platform Makefile Generator
  Module:    $RCSfile$
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  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 "cmXMLParser.h"

#include <cm_expat.h>
#include <ctype.h>

//----------------------------------------------------------------------------
cmXMLParser::cmXMLParser()
{
  this->Parser = 0;
  this->ParseError = 0;
}

//----------------------------------------------------------------------------
cmXMLParser::~cmXMLParser()
{
  if ( this->Parser )
    {
    this->CleanupParser();
    }
}

//----------------------------------------------------------------------------
int cmXMLParser::Parse(const char* string)
{
  return (int)this->InitializeParser() &&
    this->ParseChunk(string, strlen(string)) && 
    this->CleanupParser();
}

int cmXMLParser::ParseFile(const char* file)
{
  if ( !file )
    {
    return 0;
    }

  std::ifstream ifs(file);
  if ( !ifs )
    {
    return 0;
    }

  cmOStringStream str;
  str << ifs.rdbuf();
  return this->Parse(str.str().c_str());
}

//----------------------------------------------------------------------------
int cmXMLParser::InitializeParser()
{
  if ( this->Parser )
    {
    std::cerr << "Parser already initialized" << std::endl;
    this->ParseError = 1;
    return 0;
    }

  // Create the expat XML parser.
  this->Parser = XML_ParserCreate(0);
  XML_SetElementHandler(static_cast<XML_Parser>(this->Parser),
                        &cmXMLParserStartElement,
                        &cmXMLParserEndElement);
  XML_SetCharacterDataHandler(static_cast<XML_Parser>(this->Parser),
                              &cmXMLParserCharacterDataHandler);
  XML_SetUserData(static_cast<XML_Parser>(this->Parser), this);
  this->ParseError = 0;
  return 1;
}

//----------------------------------------------------------------------------
int cmXMLParser::ParseChunk(const char* inputString, 
                            std::string::size_type length)
{
  if ( !this->Parser )
    {
    std::cerr << "Parser not initialized" << std::endl;
    this->ParseError = 1;
    return 0;
    }
  int res;
  res = this->ParseBuffer(inputString, length);
  if ( res == 0 )
    {
    this->ParseError = 1;
    }
  return res;
}

//----------------------------------------------------------------------------
int cmXMLParser::CleanupParser()
{
  if ( !this->Parser )
    {
    std::cerr << "Parser not initialized" << std::endl;
    this->ParseError = 1;
    return 0;
    }
  int result = !this->ParseError;
  if(result)
    {
    // Tell the expat XML parser about the end-of-input.
    if(!XML_Parse(static_cast<XML_Parser>(this->Parser), "", 0, 1))
      {
      this->ReportXmlParseError();
      result = 0;
      }
    }
  
  // Clean up the parser.
  XML_ParserFree(static_cast<XML_Parser>(this->Parser));
  this->Parser = 0;
  
  return result;
}

//----------------------------------------------------------------------------
int cmXMLParser::ParseBuffer(const char* buffer, std::string::size_type count)
{
  // Pass the buffer to the expat XML parser.
  if(!XML_Parse(static_cast<XML_Parser>(this->Parser), buffer, 
                static_cast<int>(count), 0))
    {
    this->ReportXmlParseError();
    return 0;
    }
  return 1;
}

//----------------------------------------------------------------------------
int cmXMLParser::ParseBuffer(const char* buffer)
{
  return this->ParseBuffer(buffer, static_cast<int>(strlen(buffer)));
}

//----------------------------------------------------------------------------
int cmXMLParser::ParsingComplete()
{
  // Default behavior is to parse to end of stream.
  return 0;
}

//----------------------------------------------------------------------------
void cmXMLParser::StartElement(const char * name,
  const char ** /*atts*/)
{
  std::cout << "Start element: " << name << std::endl;
}

//----------------------------------------------------------------------------
void cmXMLParser::EndElement(const char * name)
{
  std::cout << "End element: " << name << std::endl;
}

//----------------------------------------------------------------------------
void cmXMLParser::CharacterDataHandler(const char* /*inData*/,
  int /*inLength*/)
{
}

//----------------------------------------------------------------------------
int cmXMLParser::IsSpace(char c)
{
  return isspace(c);
}

//----------------------------------------------------------------------------
void cmXMLParserStartElement(void* parser, const char *name,
                              const char **atts)
{
  // Begin element handler that is registered with the XML_Parser.
  // This just casts the user data to a cmXMLParser and calls
  // StartElement.
  static_cast<cmXMLParser*>(parser)->StartElement(name, atts);
}

//----------------------------------------------------------------------------
void cmXMLParserEndElement(void* parser, const char *name)
{
  // End element handler that is registered with the XML_Parser.  This
  // just casts the user data to a cmXMLParser and calls EndElement.
  static_cast<cmXMLParser*>(parser)->EndElement(name);
}

//----------------------------------------------------------------------------
void cmXMLParserCharacterDataHandler(void* parser, const char* data,
                                      int length)
{
  // Character data handler that is registered with the XML_Parser.
  // This just casts the user data to a cmXMLParser and calls
  // CharacterDataHandler.
  static_cast<cmXMLParser*>(parser)->CharacterDataHandler(data, length);
}

//----------------------------------------------------------------------------
void cmXMLParser::ReportXmlParseError()
{
  std::cerr << "Error parsing XML in stream at line "
    << XML_GetCurrentLineNumber(static_cast<XML_Parser>(this->Parser))
    << ": " 
    << XML_ErrorString(XML_GetErrorCode(
        static_cast<XML_Parser>(this->Parser))) << std::endl;
}

which +preferred over the files in :variable:`CMAKE_MODULE_PATH`. This makes sure +that the modules belonging to CMake always get those files included which they expect, and against which they were developed and tested. In all -other cases, the files found in CMAKE_MODULE_PATH still take +other cases, the files found in :variable:`CMAKE_MODULE_PATH` still take precedence over the ones in the CMake module directory. The OLD behavior is to always prefer files from CMAKE_MODULE_PATH over files from the CMake modules directory. This policy was introduced in CMake version 2.8.4. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst index a3a7a12..6248406 100644 --- a/Help/policy/CMP0018.rst +++ b/Help/policy/CMP0018.rst @@ -1,34 +1,35 @@ CMP0018 ------- -Ignore CMAKE_SHARED_LIBRARY__FLAGS variable. +Ignore ``CMAKE_SHARED_LIBRARY__FLAGS`` variable. -CMake 2.8.8 and lower compiled sources in SHARED and MODULE libraries -using the value of the undocumented CMAKE_SHARED_LIBRARY__FLAGS +CMake 2.8.8 and lower compiled sources in ``SHARED`` and ``MODULE`` libraries +using the value of the undocumented ``CMAKE_SHARED_LIBRARY__FLAGS`` platform variable. The variable contained platform-specific flags needed to compile objects for shared libraries. Typically it included -a flag such as -fPIC for position independent code but also included +a flag such as ``-fPIC`` for position independent code but also included other flags needed on certain platforms. CMake 2.8.9 and higher -prefer instead to use the POSITION_INDEPENDENT_CODE target property to -determine what targets should be position independent, and new +prefer instead to use the :prop_tgt:`POSITION_INDEPENDENT_CODE` target +property to determine what targets should be position independent, and new undocumented platform variables to select flags while ignoring -CMAKE_SHARED_LIBRARY__FLAGS completely. +``CMAKE_SHARED_LIBRARY__FLAGS`` completely. The default for either approach produces identical compilation flags, -but if a project modifies CMAKE_SHARED_LIBRARY__FLAGS from its +but if a project modifies ``CMAKE_SHARED_LIBRARY__FLAGS`` from its original value this policy determines which approach to use. -The OLD behavior for this policy is to ignore the -POSITION_INDEPENDENT_CODE property for all targets and use the -modified value of CMAKE_SHARED_LIBRARY__FLAGS for SHARED and -MODULE libraries. +The ``OLD`` behavior for this policy is to ignore the +:prop_tgt:`POSITION_INDEPENDENT_CODE` property for all targets and use the +modified value of ``CMAKE_SHARED_LIBRARY__FLAGS`` for ``SHARED`` and +``MODULE`` libraries. -The NEW behavior for this policy is to ignore -CMAKE_SHARED_LIBRARY__FLAGS whether it is modified or not and -honor the POSITION_INDEPENDENT_CODE target property. +The ``NEW`` behavior for this policy is to ignore +``CMAKE_SHARED_LIBRARY__FLAGS`` whether it is modified or not and +honor the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property. This policy was introduced in CMake version 2.8.9. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst index 2e3557d..682dcdf 100644 --- a/Help/policy/CMP0019.rst +++ b/Help/policy/CMP0019.rst @@ -11,12 +11,12 @@ CMake versions because all variable references are now normally evaluated during CMake language processing. CMake 2.8.11 and higher prefer to skip the extra evaluation. -The OLD behavior for this policy is to re-evaluate the values for -strict compatibility. The NEW behavior for this policy is to leave +The ``OLD`` behavior for this policy is to re-evaluate the values for +strict compatibility. The ``NEW`` behavior for this policy is to leave the values untouched. This policy was introduced in CMake version 2.8.11. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst index 75ca9de..6d27684 100644 --- a/Help/policy/CMP0020.rst +++ b/Help/policy/CMP0020.rst @@ -1,27 +1,27 @@ CMP0020 ------- -Automatically link Qt executables to qtmain target on Windows. +Automatically link Qt executables to ``qtmain`` target on Windows. CMake 2.8.10 and lower required users of Qt to always specify a link -dependency to the qtmain.lib static library manually on Windows. +dependency to the ``qtmain.lib`` static library manually on Windows. CMake 2.8.11 gained the ability to evaluate generator expressions -while determining the link dependencies from IMPORTED targets. This +while determining the link dependencies from ``IMPORTED`` targets. This allows CMake itself to automatically link executables which link to Qt -to the qtmain.lib library when using IMPORTED Qt targets. For -applications already linking to qtmain.lib, this should have little +to the ``qtmain.lib`` library when using ``IMPORTED`` Qt targets. For +applications already linking to ``qtmain.lib``, this should have little impact. For applications which supply their own alternative WinMain implementation and for applications which use the QAxServer library, this automatic linking will need to be disabled as per the documentation. -The OLD behavior for this policy is not to link executables to -qtmain.lib automatically when they link to the QtCore IMPORTED target. -The NEW behavior for this policy is to link executables to qtmain.lib -automatically when they link to QtCore IMPORTED target. +The ``OLD`` behavior for this policy is not to link executables to +``qtmain.lib`` automatically when they link to the QtCore ``IMPORTED`` target. +The ``NEW`` behavior for this policy is to link executables to ``qtmain.lib`` +automatically when they link to QtCore ``IMPORTED`` target. This policy was introduced in CMake version 2.8.11. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst index 3a792ca..937b106 100644 --- a/Help/policy/CMP0021.rst +++ b/Help/policy/CMP0021.rst @@ -1,20 +1,21 @@ CMP0021 ------- -Fatal error on relative paths in INCLUDE_DIRECTORIES target property. +Fatal error on relative paths in :prop_tgt:`INCLUDE_DIRECTORIES` target +property. -CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target +CMake 2.8.10.2 and lower allowed the :prop_tgt:`INCLUDE_DIRECTORIES` target property to contain relative paths. The base path for such relative -entries is not well defined. CMake 2.8.12 issues a FATAL_ERROR if the -INCLUDE_DIRECTORIES property contains a relative path. +entries is not well defined. CMake 2.8.12 issues a ``FATAL_ERROR`` if the +:prop_tgt:`INCLUDE_DIRECTORIES` property contains a relative path. -The OLD behavior for this policy is not to warn about relative paths -in the INCLUDE_DIRECTORIES target property. The NEW behavior for this -policy is to issue a FATAL_ERROR if INCLUDE_DIRECTORIES contains a +The ``OLD`` behavior for this policy is not to warn about relative paths +in the ``INCLUDE_DIRECTORIES`` target property. The ``NEW`` behavior for this +policy is to issue a ``FATAL_ERROR`` if ``INCLUDE_DIRECTORIES`` contains a relative path. This policy was introduced in CMake version 2.8.12. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 579d09a..be60e37 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -1,39 +1,39 @@ CMP0022 ------- -INTERFACE_LINK_LIBRARIES defines the link interface. +:prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface. CMake 2.8.11 constructed the 'link interface' of a target from properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. The modern way to specify config-sensitive content is to use generator expressions and the ``IMPORTED_`` prefix makes uniform processing of the link interface with generator expressions impossible. The -INTERFACE_LINK_LIBRARIES target property was introduced as a +:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property was introduced as a replacement in CMake 2.8.12. This new property is named consistently -with the INTERFACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES -and INTERFACE_COMPILE_OPTIONS properties. For in-build targets, CMake +with the ``INTERFACE_COMPILE_DEFINITIONS``, ``INTERFACE_INCLUDE_DIRECTORIES`` +and ``INTERFACE_COMPILE_OPTIONS`` properties. For in-build targets, CMake will use the INTERFACE_LINK_LIBRARIES property as the source of the -link interface only if policy CMP0022 is NEW. When exporting a target -which has this policy set to NEW, only the INTERFACE_LINK_LIBRARIES -property will be processed and generated for the IMPORTED target by -default. A new option to the install(EXPORT) and export commands +link interface only if policy ``CMP0022`` is ``NEW``. When exporting a target +which has this policy set to ``NEW``, only the :prop_tgt:`INTERFACE_LINK_LIBRARIES` +property will be processed and generated for the ``IMPORTED`` target by +default. A new option to the :command:`install(EXPORT)` and export commands allows export of the old-style properties for compatibility with downstream users of CMake versions older than 2.8.12. The -target_link_libraries command will no longer populate the properties -matching LINK_INTERFACE_LIBRARIES(_)? if this policy is NEW. +:command:`target_link_libraries` command will no longer populate the properties +matching ``LINK_INTERFACE_LIBRARIES(_)?`` if this policy is ``NEW``. Warning-free future-compatible code which works with CMake 2.8.7 onwards can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords of :command:`target_link_libraries`. -The OLD behavior for this policy is to ignore the -INTERFACE_LINK_LIBRARIES property for in-build targets. The NEW -behavior for this policy is to use the INTERFACE_LINK_LIBRARIES +The ``OLD`` behavior for this policy is to ignore the +:prop_tgt:`INTERFACE_LINK_LIBRARIES` property for in-build targets. +The ``NEW`` behavior for this policy is to use the ``INTERFACE_LINK_LIBRARIES`` property for in-build targets, and ignore the old properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)?``. This policy was introduced in CMake version 2.8.12. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst index 76a4900..3c72c81 100644 --- a/Help/policy/CMP0023.rst +++ b/Help/policy/CMP0023.rst @@ -1,15 +1,15 @@ CMP0023 ------- -Plain and keyword target_link_libraries signatures cannot be mixed. +Plain and keyword :command:`target_link_libraries` signatures cannot be mixed. -CMake 2.8.12 introduced the target_link_libraries signature using the -PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC -and LINK_PRIVATE keywords introduced in CMake 2.8.7. Use of -signatures with any of these keywords sets the link interface of a +CMake 2.8.12 introduced the :command:`target_link_libraries` signature using +the ``PUBLIC``, ``PRIVATE``, and ``INTERFACE`` keywords to generalize the +``LINK_PUBLIC`` and ``LINK_PRIVATE`` keywords introduced in CMake 2.8.7. +Use of signatures with any of these keywords sets the link interface of a target explicitly, even if empty. This produces confusing behavior when used in combination with the historical behavior of the plain -target_link_libraries signature. For example, consider the code: +:command:`target_link_libraries` signature. For example, consider the code: :: @@ -20,16 +20,16 @@ After the first line the link interface has not been set explicitly so CMake would use the link implementation, A, as the link interface. However, the second line sets the link interface to empty. In order to avoid this subtle behavior CMake now prefers to disallow mixing the -plain and keyword signatures of target_link_libraries for a single +plain and keyword signatures of :command:`target_link_libraries` for a single target. -The OLD behavior for this policy is to allow keyword and plain -target_link_libraries signatures to be mixed. The NEW behavior for +The ``OLD`` behavior for this policy is to allow keyword and plain +:command:`target_link_libraries` signatures to be mixed. The ``NEW`` behavior for this policy is to not to allow mixing of the keyword and plain signatures. This policy was introduced in CMake version 2.8.12. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index 272a56c..6e24b04 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -3,22 +3,23 @@ CMP0024 Disallow include export result. -CMake 2.8.12 and lower allowed use of the include() command with the -result of the export() command. This relies on the assumption that -the export() command has an immediate effect at configure-time during +CMake 2.8.12 and lower allowed use of the :command:`include` command with the +result of the :command:`export` command. This relies on the assumption that +the :command:`export` command has an immediate effect at configure-time during a cmake run. Certain properties of targets are not fully determined until later at generate-time, such as the link language and complete list of link libraries. Future refactoring will change the effect of -the export() command to be executed at generate-time. Use ALIAS +the :command:`export` command to be executed at generate-time. Use ``ALIAS`` targets instead in cases where the goal is to refer to targets by another name. -The OLD behavior for this policy is to allow including the result of -an export() command. The NEW behavior for this policy is not to -allow including the result of an export() command. +The ``OLD`` behavior for this policy is to allow including the result of +an :command:`export` command. The ``NEW`` behavior for this policy is not to +allow including the result of an :command:`export` command. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index 62dd509..ba5e1e9 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -15,13 +15,13 @@ language ```` is enabled by the :command:`project` or :command:`enable_language` command. The policy must be set prior to the invocation of either command. -The OLD behavior for this policy is to use compiler id ``Clang``. The -NEW behavior for this policy is to use compiler id ``AppleClang``. +The ``OLD`` behavior for this policy is to use compiler id ``Clang``. The +``NEW`` behavior for this policy is to use compiler id ``AppleClang``. This policy was introduced in CMake version 3.0. Use the -:command:`cmake_policy` command to set this policy to OLD or NEW explicitly. -Unlike most policies, CMake version |release| does *not* warn -by default when this policy is not set and simply uses OLD behavior. +:command:`cmake_policy` command to set this policy to ``OLD`` or ``NEW`` +explicitly. Unlike most policies, CMake version |release| does *not* warn +by default when this policy is not set and simply uses ``OLD`` behavior. See documentation of the :variable:`CMAKE_POLICY_WARNING_CMP0025 >` variable to control the warning. diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst index 3fe1374..3401d4a 100644 --- a/Help/policy/CMP0026.rst +++ b/Help/policy/CMP0026.rst @@ -3,26 +3,27 @@ CMP0026 Disallow use of the LOCATION property for build targets. -CMake 2.8.12 and lower allowed reading the LOCATION target +CMake 2.8.12 and lower allowed reading the :prop_tgt:`LOCATION` target property (and configuration-specific variants) to determine the eventual location of build targets. This relies on the assumption that all necessary information is available at configure-time to determine the final location and filename of the target. However, this property is not fully determined until later at -generate-time. At generate time, the $ generator -expression can be used to determine the eventual LOCATION of a target +generate-time. At generate time, the ``$`` generator +expression can be used to determine the eventual :prop_tgt:`LOCATION` of a target output. -Code which reads the LOCATION target property can be ported to use the -$ generator expression together with the file(GENERATE) -subcommand to generate a file containing the target location. +Code which reads the :prop_tgt:`LOCATION` target property can be ported to +use the ``$`` generator expression together with the +:command:`file(GENERATE)` subcommand to generate a file containing +the target location. -The OLD behavior for this policy is to allow reading the LOCATION -properties from build-targets. The NEW behavior for this policy is to -not to allow reading the LOCATION properties from build-targets. +The ``OLD`` behavior for this policy is to allow reading the :prop_tgt:`LOCATION` +properties from build-targets. The ``NEW`` behavior for this policy is to +not to allow reading the :prop_tgt:`LOCATION` properties from build-targets. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst index 28913ce..bf7b6a9 100644 --- a/Help/policy/CMP0027.rst +++ b/Help/policy/CMP0027.rst @@ -4,24 +4,24 @@ CMP0027 Conditionally linked imported targets with missing include directories. CMake 2.8.11 introduced introduced the concept of -INTERFACE_INCLUDE_DIRECTORIES, and a check at cmake time that the -entries in the INTERFACE_INCLUDE_DIRECTORIES of an IMPORTED target -actually exist. CMake 2.8.11 also introduced generator expression -support in the target_link_libraries command. However, if an imported -target is linked as a result of a generator expression evaluation, the -entries in the INTERFACE_INCLUDE_DIRECTORIES of that target were not +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`, and a check at cmake time that the +entries in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of an ``IMPORTED`` +target actually exist. CMake 2.8.11 also introduced generator expression +support in the :command:`target_link_libraries` command. However, if an +imported target is linked as a result of a generator expression evaluation, the +entries in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of that target were not checked for existence as they should be. -The OLD behavior of this policy is to report a warning if an entry in -the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression -conditionally linked IMPORTED target does not exist. +The ``OLD`` behavior of this policy is to report a warning if an entry in +the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a generator-expression +conditionally linked ``IMPORTED`` target does not exist. -The NEW behavior of this policy is to report an error if an entry in -the INTERFACE_INCLUDE_DIRECTORIES of a generator-expression -conditionally linked IMPORTED target does not exist. +The ``NEW`` behavior of this policy is to report an error if an entry in +the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of a generator-expression +conditionally linked ``IMPORTED`` target does not exist. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst index be57125..ab38229 100644 --- a/Help/policy/CMP0028.rst +++ b/Help/policy/CMP0028.rst @@ -1,25 +1,25 @@ CMP0028 ------- -Double colon in target name means ALIAS or IMPORTED target. +Double colon in target name means ``ALIAS`` or ``IMPORTED`` target. CMake 2.8.12 and lower allowed the use of targets and files with double -colons in target_link_libraries, with some buildsystem generators. +colons in :command:`target_link_libraries`, with some buildsystem generators. -The use of double-colons is a common pattern used to namespace IMPORTED -targets and ALIAS targets. When computing the link dependencies of a target, -the name of each dependency could either be a target, or a file on disk. -Previously, if a target was not found with a matching name, the name was -considered to refer to a file on disk. This can lead to confusing error +The use of double-colons is a common pattern used to namespace ``IMPORTED`` +targets and ``ALIAS`` targets. When computing the link dependencies of +a target, the name of each dependency could either be a target, or a file +on disk. Previously, if a target was not found with a matching name, the name +was considered to refer to a file on disk. This can lead to confusing error messages if there is a typo in what should be a target name. -The OLD behavior for this policy is to search for targets, then files on disk, -even if the search term contains double-colons. The NEW behavior for this -policy is to issue a FATAL_ERROR if a link dependency contains -double-colons but is not an IMPORTED target or an ALIAS target. +The ``OLD`` behavior for this policy is to search for targets, then files on +disk, even if the search term contains double-colons. The ``NEW`` behavior +for this policy is to issue a ``FATAL_ERROR`` if a link dependency contains +double-colons but is not an ``IMPORTED`` target or an ``ALIAS`` target. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index d1afeb7..c028b41 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -11,23 +11,23 @@ diagnostics expect target names to match a restricted pattern. Target names may contain upper and lower case letters, numbers, the underscore character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS -targets and IMPORTED targets may contain two consecutive colons. +targets and ``IMPORTED`` targets may contain two consecutive colons. Target names reserved by one or more CMake generators are not allowed. -Among others these include "all", "clean", "help", and "install". +Among others these include ``all``, ``clean``, ``help``, and ``install``. -Target names associated with optional features, such as "test" and "package", -may also be reserved. CMake 3.10 and below always reserve them. CMake 3.11 -and above reserve them only when the corresponding feature is enabled -(e.g. by including the :module:`CTest` or :module:`CPack` modules). +Target names associated with optional features, such as ``test`` and +``package``, may also be reserved. CMake 3.10 and below always reserve them. +CMake 3.11 and above reserve them only when the corresponding feature is +enabled (e.g. by including the :module:`CTest` or :module:`CPack` modules). -The OLD behavior for this policy is to allow creating targets with +The ``OLD`` behavior for this policy is to allow creating targets with reserved names or which do not match the validity pattern. -The NEW behavior for this policy is to report an error +The ``NEW`` behavior for this policy is to report an error if an add_* command is used with an invalid target name. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst index a306d90..7fb2209 100644 --- a/Help/policy/CMP0038.rst +++ b/Help/policy/CMP0038.rst @@ -7,12 +7,12 @@ CMake 2.8.12 and lower allowed a build target to link to itself directly with a :command:`target_link_libraries` call. This is an indicator of a bug in user code. -The OLD behavior for this policy is to ignore targets which list themselves -in their own link implementation. The NEW behavior for this policy is to +The ``OLD`` behavior for this policy is to ignore targets which list themselves +in their own link implementation. The ``NEW`` behavior for this policy is to report an error if a target attempts to link to itself. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst index 97d78ae..4b14e21 100644 --- a/Help/policy/CMP0039.rst +++ b/Help/policy/CMP0039.rst @@ -7,13 +7,13 @@ CMake 2.8.12 and lower allowed using utility targets in the left hand side position of the :command:`target_link_libraries` command. This is an indicator of a bug in user code. -The OLD behavior for this policy is to ignore attempts to set the link -libraries of utility targets. The NEW behavior for this policy is to +The ``OLD`` behavior for this policy is to ignore attempts to set the link +libraries of utility targets. The ``NEW`` behavior for this policy is to report an error if an attempt is made to set the link libraries of a utility target. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst index f027d5d..3b4df36 100644 --- a/Help/policy/CMP0041.rst +++ b/Help/policy/CMP0041.rst @@ -15,13 +15,13 @@ As an additional diagnostic, the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` gener on an :prop_tgt:`IMPORTED` target for the install location should not contain paths in the source directory or the build directory. -The OLD behavior for this policy is to ignore relative path entries if they -contain a generator expression. The NEW behavior for this policy is to report +The ``OLD`` behavior for this policy is to ignore relative path entries if they +contain a generator expression. The ``NEW`` behavior for this policy is to report an error if a generator expression appears in another location and the path is relative. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst index 31314b2..0877564 100644 --- a/Help/policy/CMP0042.rst +++ b/Help/policy/CMP0042.rst @@ -15,7 +15,7 @@ the :prop_tgt:`INSTALL_NAME_DIR` and :variable:`CMAKE_INSTALL_NAME_DIR` variables. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst index 9e427c3..05210ac 100644 --- a/Help/policy/CMP0043.rst +++ b/Help/policy/CMP0043.rst @@ -35,13 +35,13 @@ or via :command:`target_compile_definitions`: COMPILE_DEFINITIONS $<$:DIR_DEBUG_MODE> ) -The OLD behavior for this policy is to consume the content of the suffixed +The ``OLD`` behavior for this policy is to consume the content of the suffixed :prop_tgt:`COMPILE_DEFINITIONS_` target property when generating the -compilation command. The NEW behavior for this policy is to ignore the content +compilation command. The ``NEW`` behavior for this policy is to ignore the content of the :prop_tgt:`COMPILE_DEFINITIONS_` target property . This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst index 02afa9f..6a4d040 100644 --- a/Help/policy/CMP0044.rst +++ b/Help/policy/CMP0044.rst @@ -9,13 +9,13 @@ comparison of the :variable:`CMAKE__COMPILER_ID` with a test value. The possible valid values are lowercase, but the comparison with the test value was performed case-insensitively. -The OLD behavior for this policy is to perform a case-insensitive comparison -with the value in the ``_COMPILER_ID`` expression. The NEW behavior +The ``OLD`` behavior for this policy is to perform a case-insensitive comparison +with the value in the ``_COMPILER_ID`` expression. The ``NEW`` behavior for this policy is to perform a case-sensitive comparison with the value in the ``_COMPILER_ID`` expression. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst index c7e1a90f6..80e217b 100644 --- a/Help/policy/CMP0045.rst +++ b/Help/policy/CMP0045.rst @@ -7,13 +7,13 @@ In CMake 2.8.12 and lower, the :command:`get_target_property` command accepted a non-existent target argument without issuing any error or warning. The result variable is set to a ``-NOTFOUND`` value. -The OLD behavior for this policy is to issue no warning and set the result -variable to a ``-NOTFOUND`` value. The NEW behavior +The ``OLD`` behavior for this policy is to issue no warning and set the result +variable to a ``-NOTFOUND`` value. The ``NEW`` behavior for this policy is to issue a ``FATAL_ERROR`` if the command is called with a non-existent target. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst index 576d1b1..bf78584 100644 --- a/Help/policy/CMP0046.rst +++ b/Help/policy/CMP0046.rst @@ -6,14 +6,14 @@ Error on non-existent dependency in add_dependencies. CMake 2.8.12 and lower silently ignored non-existent dependencies listed in the :command:`add_dependencies` command. -The OLD behavior for this policy is to silently ignore non-existent -dependencies. The NEW behavior for this policy is to report an error +The ``OLD`` behavior for this policy is to silently ignore non-existent +dependencies. The ``NEW`` behavior for this policy is to report an error if non-existent dependencies are listed in the :command:`add_dependencies` command. This policy was introduced in CMake version 3.0. CMake version |release| warns when the policy is not set and uses -OLD behavior. Use the cmake_policy command to set it to OLD or -NEW explicitly. +``OLD`` behavior. Use the :command:`cmake_policy` command to set it +to ``OLD`` or ``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index 882dd78..9588edd 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -15,14 +15,14 @@ language ```` is enabled by the :command:`project` or :command:`enable_language` command. The policy must be set prior to the invocation of either command. -The OLD behavior for this policy