cmCommands.cxx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCommands.h"
  4. #include "cmPolicies.h"
  5. #include "cmState.h"
  6. #include "cmAddCustomCommandCommand.h"
  7. #include "cmAddCustomTargetCommand.h"
  8. #include "cmAddDefinitionsCommand.h"
  9. #include "cmAddDependenciesCommand.h"
  10. #include "cmAddExecutableCommand.h"
  11. #include "cmAddLibraryCommand.h"
  12. #include "cmAddSubDirectoryCommand.h"
  13. #include "cmAddTestCommand.h"
  14. #include "cmBreakCommand.h"
  15. #include "cmBuildCommand.h"
  16. #include "cmCMakeMinimumRequired.h"
  17. #include "cmCMakePolicyCommand.h"
  18. #include "cmConfigureFileCommand.h"
  19. #include "cmContinueCommand.h"
  20. #include "cmCreateTestSourceList.h"
  21. #include "cmDefinePropertyCommand.h"
  22. #include "cmEnableLanguageCommand.h"
  23. #include "cmEnableTestingCommand.h"
  24. #include "cmExecProgramCommand.h"
  25. #include "cmExecuteProcessCommand.h"
  26. #include "cmFileCommand.h"
  27. #include "cmFindFileCommand.h"
  28. #include "cmFindLibraryCommand.h"
  29. #include "cmFindPackageCommand.h"
  30. #include "cmFindPathCommand.h"
  31. #include "cmFindProgramCommand.h"
  32. #include "cmForEachCommand.h"
  33. #include "cmFunctionCommand.h"
  34. #include "cmGetCMakePropertyCommand.h"
  35. #include "cmGetDirectoryPropertyCommand.h"
  36. #include "cmGetFilenameComponentCommand.h"
  37. #include "cmGetPropertyCommand.h"
  38. #include "cmGetSourceFilePropertyCommand.h"
  39. #include "cmGetTargetPropertyCommand.h"
  40. #include "cmGetTestPropertyCommand.h"
  41. #include "cmIfCommand.h"
  42. #include "cmIncludeCommand.h"
  43. #include "cmIncludeDirectoryCommand.h"
  44. #include "cmIncludeRegularExpressionCommand.h"
  45. #include "cmInstallCommand.h"
  46. #include "cmInstallFilesCommand.h"
  47. #include "cmInstallTargetsCommand.h"
  48. #include "cmLinkDirectoriesCommand.h"
  49. #include "cmListCommand.h"
  50. #include "cmMacroCommand.h"
  51. #include "cmMakeDirectoryCommand.h"
  52. #include "cmMarkAsAdvancedCommand.h"
  53. #include "cmMathCommand.h"
  54. #include "cmMessageCommand.h"
  55. #include "cmOptionCommand.h"
  56. #include "cmParseArgumentsCommand.h"
  57. #include "cmProjectCommand.h"
  58. #include "cmReturnCommand.h"
  59. #include "cmSeparateArgumentsCommand.h"
  60. #include "cmSetCommand.h"
  61. #include "cmSetDirectoryPropertiesCommand.h"
  62. #include "cmSetPropertyCommand.h"
  63. #include "cmSetSourceFilesPropertiesCommand.h"
  64. #include "cmSetTargetPropertiesCommand.h"
  65. #include "cmSetTestsPropertiesCommand.h"
  66. #include "cmSiteNameCommand.h"
  67. #include "cmStringCommand.h"
  68. #include "cmSubdirCommand.h"
  69. #include "cmTargetLinkLibrariesCommand.h"
  70. #include "cmTryCompileCommand.h"
  71. #include "cmTryRunCommand.h"
  72. #include "cmUnexpectedCommand.h"
  73. #include "cmUnsetCommand.h"
  74. #include "cmWhileCommand.h"
  75. #if defined(CMAKE_BUILD_WITH_CMAKE)
  76. #include "cmAddCompileOptionsCommand.h"
  77. #include "cmAuxSourceDirectoryCommand.h"
  78. #include "cmBuildNameCommand.h"
  79. #include "cmCMakeHostSystemInformationCommand.h"
  80. #include "cmDisallowedCommand.h"
  81. #include "cmExportCommand.h"
  82. #include "cmExportLibraryDependenciesCommand.h"
  83. #include "cmFLTKWrapUICommand.h"
  84. #include "cmIncludeExternalMSProjectCommand.h"
  85. #include "cmInstallProgramsCommand.h"
  86. #include "cmLinkLibrariesCommand.h"
  87. #include "cmLoadCacheCommand.h"
  88. #include "cmLoadCommandCommand.h"
  89. #include "cmOutputRequiredFilesCommand.h"
  90. #include "cmQTWrapCPPCommand.h"
  91. #include "cmQTWrapUICommand.h"
  92. #include "cmRemoveCommand.h"
  93. #include "cmRemoveDefinitionsCommand.h"
  94. #include "cmSourceGroupCommand.h"
  95. #include "cmSubdirDependsCommand.h"
  96. #include "cmTargetCompileDefinitionsCommand.h"
  97. #include "cmTargetCompileFeaturesCommand.h"
  98. #include "cmTargetCompileOptionsCommand.h"
  99. #include "cmTargetIncludeDirectoriesCommand.h"
  100. #include "cmTargetSourcesCommand.h"
  101. #include "cmUseMangledMesaCommand.h"
  102. #include "cmUtilitySourceCommand.h"
  103. #include "cmVariableRequiresCommand.h"
  104. #include "cmVariableWatchCommand.h"
  105. #include "cmWriteFileCommand.h"
  106. #endif
  107. void GetScriptingCommands(cmState* state)
  108. {
  109. state->AddCommand(new cmBreakCommand);
  110. state->AddCommand(new cmCMakeMinimumRequired);
  111. state->AddCommand(new cmCMakePolicyCommand);
  112. state->AddCommand(new cmConfigureFileCommand);
  113. state->AddCommand(new cmContinueCommand);
  114. state->AddCommand(new cmExecProgramCommand);
  115. state->AddCommand(new cmExecuteProcessCommand);
  116. state->AddCommand(new cmFileCommand);
  117. state->AddCommand(new cmFindFileCommand);
  118. state->AddCommand(new cmFindLibraryCommand);
  119. state->AddCommand(new cmFindPackageCommand);
  120. state->AddCommand(new cmFindPathCommand);
  121. state->AddCommand(new cmFindProgramCommand);
  122. state->AddCommand(new cmForEachCommand);
  123. state->AddCommand(new cmFunctionCommand);
  124. state->AddCommand(new cmGetCMakePropertyCommand);
  125. state->AddCommand(new cmGetDirectoryPropertyCommand);
  126. state->AddCommand(new cmGetFilenameComponentCommand);
  127. state->AddCommand(new cmGetPropertyCommand);
  128. state->AddCommand(new cmIfCommand);
  129. state->AddCommand(new cmIncludeCommand);
  130. state->AddCommand(new cmListCommand);
  131. state->AddCommand(new cmMacroCommand);
  132. state->AddCommand(new cmMakeDirectoryCommand);
  133. state->AddCommand(new cmMarkAsAdvancedCommand);
  134. state->AddCommand(new cmMathCommand);
  135. state->AddCommand(new cmMessageCommand);
  136. state->AddCommand(new cmOptionCommand);
  137. state->AddCommand(new cmParseArgumentsCommand);
  138. state->AddCommand(new cmReturnCommand);
  139. state->AddCommand(new cmSeparateArgumentsCommand);
  140. state->AddCommand(new cmSetCommand);
  141. state->AddCommand(new cmSetDirectoryPropertiesCommand);
  142. state->AddCommand(new cmSetPropertyCommand);
  143. state->AddCommand(new cmSiteNameCommand);
  144. state->AddCommand(new cmStringCommand);
  145. state->AddCommand(new cmUnsetCommand);
  146. state->AddCommand(new cmWhileCommand);
  147. state->AddCommand(new cmUnexpectedCommand(
  148. "else", "An ELSE command was found outside of a proper "
  149. "IF ENDIF structure. Or its arguments did not match "
  150. "the opening IF command."));
  151. state->AddCommand(new cmUnexpectedCommand(
  152. "elseif", "An ELSEIF command was found outside of a proper "
  153. "IF ENDIF structure."));
  154. state->AddCommand(new cmUnexpectedCommand(
  155. "endforeach", "An ENDFOREACH command was found outside of a proper "
  156. "FOREACH ENDFOREACH structure. Or its arguments did "
  157. "not match the opening FOREACH command."));
  158. state->AddCommand(new cmUnexpectedCommand(
  159. "endfunction", "An ENDFUNCTION command was found outside of a proper "
  160. "FUNCTION ENDFUNCTION structure. Or its arguments did not "
  161. "match the opening FUNCTION command."));
  162. state->AddCommand(new cmUnexpectedCommand(
  163. "endif", "An ENDIF command was found outside of a proper "
  164. "IF ENDIF structure. Or its arguments did not match "
  165. "the opening IF command."));
  166. state->AddCommand(new cmUnexpectedCommand(
  167. "endmacro", "An ENDMACRO command was found outside of a proper "
  168. "MACRO ENDMACRO structure. Or its arguments did not "
  169. "match the opening MACRO command."));
  170. state->AddCommand(new cmUnexpectedCommand(
  171. "endwhile", "An ENDWHILE command was found outside of a proper "
  172. "WHILE ENDWHILE structure. Or its arguments did not "
  173. "match the opening WHILE command."));
  174. #if defined(CMAKE_BUILD_WITH_CMAKE)
  175. state->AddCommand(new cmCMakeHostSystemInformationCommand);
  176. state->AddCommand(new cmRemoveCommand);
  177. state->AddCommand(new cmVariableWatchCommand);
  178. state->AddCommand(new cmWriteFileCommand);
  179. state->AddCommand(new cmDisallowedCommand(
  180. new cmBuildNameCommand, cmPolicies::CMP0036,
  181. "The build_name command should not be called; see CMP0036."));
  182. state->AddCommand(new cmDisallowedCommand(
  183. new cmUseMangledMesaCommand, cmPolicies::CMP0030,
  184. "The use_mangled_mesa command should not be called; see CMP0030."));
  185. #endif
  186. }
  187. void GetProjectCommands(cmState* state)
  188. {
  189. state->AddCommand(new cmAddCustomCommandCommand);
  190. state->AddCommand(new cmAddCustomTargetCommand);
  191. state->AddCommand(new cmAddDefinitionsCommand);
  192. state->AddCommand(new cmAddDependenciesCommand);
  193. state->AddCommand(new cmAddExecutableCommand);
  194. state->AddCommand(new cmAddLibraryCommand);
  195. state->AddCommand(new cmAddSubDirectoryCommand);
  196. state->AddCommand(new cmAddTestCommand);
  197. state->AddCommand(new cmBuildCommand);
  198. state->AddCommand(new cmCreateTestSourceList);
  199. state->AddCommand(new cmDefinePropertyCommand);
  200. state->AddCommand(new cmEnableLanguageCommand);
  201. state->AddCommand(new cmEnableTestingCommand);
  202. state->AddCommand(new cmGetSourceFilePropertyCommand);
  203. state->AddCommand(new cmGetTargetPropertyCommand);
  204. state->AddCommand(new cmGetTestPropertyCommand);
  205. state->AddCommand(new cmIncludeDirectoryCommand);
  206. state->AddCommand(new cmIncludeRegularExpressionCommand);
  207. state->AddCommand(new cmInstallCommand);
  208. state->AddCommand(new cmInstallFilesCommand);
  209. state->AddCommand(new cmInstallTargetsCommand);
  210. state->AddCommand(new cmLinkDirectoriesCommand);
  211. state->AddCommand(new cmProjectCommand);
  212. state->AddCommand(new cmSetSourceFilesPropertiesCommand);
  213. state->AddCommand(new cmSetTargetPropertiesCommand);
  214. state->AddCommand(new cmSetTestsPropertiesCommand);
  215. state->AddCommand(new cmSubdirCommand);
  216. state->AddCommand(new cmTargetLinkLibrariesCommand);
  217. state->AddCommand(new cmTryCompileCommand);
  218. state->AddCommand(new cmTryRunCommand);
  219. #if defined(CMAKE_BUILD_WITH_CMAKE)
  220. state->AddCommand(new cmAddCompileOptionsCommand);
  221. state->AddCommand(new cmAuxSourceDirectoryCommand);
  222. state->AddCommand(new cmExportCommand);
  223. state->AddCommand(new cmFLTKWrapUICommand);
  224. state->AddCommand(new cmIncludeExternalMSProjectCommand);
  225. state->AddCommand(new cmInstallProgramsCommand);
  226. state->AddCommand(new cmLinkLibrariesCommand);
  227. state->AddCommand(new cmLoadCacheCommand);
  228. state->AddCommand(new cmQTWrapCPPCommand);
  229. state->AddCommand(new cmQTWrapUICommand);
  230. state->AddCommand(new cmRemoveDefinitionsCommand);
  231. state->AddCommand(new cmSourceGroupCommand);
  232. state->AddCommand(new cmTargetCompileDefinitionsCommand);
  233. state->AddCommand(new cmTargetCompileFeaturesCommand);
  234. state->AddCommand(new cmTargetCompileOptionsCommand);
  235. state->AddCommand(new cmTargetIncludeDirectoriesCommand);
  236. state->AddCommand(new cmTargetSourcesCommand);
  237. state->AddCommand(new cmDisallowedCommand(
  238. new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
  239. "The export_library_dependencies command should not be called; "
  240. "see CMP0033."));
  241. state->AddCommand(new cmDisallowedCommand(
  242. new cmLoadCommandCommand, cmPolicies::CMP0031,
  243. "The load_command command should not be called; see CMP0031."));
  244. state->AddCommand(new cmDisallowedCommand(
  245. new cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
  246. "The output_required_files command should not be called; "
  247. "see CMP0032."));
  248. state->AddCommand(new cmDisallowedCommand(
  249. new cmSubdirDependsCommand, cmPolicies::CMP0029,
  250. "The subdir_depends command should not be called; see CMP0029."));
  251. state->AddCommand(new cmDisallowedCommand(
  252. new cmUtilitySourceCommand, cmPolicies::CMP0034,
  253. "The utility_source command should not be called; see CMP0034."));
  254. state->AddCommand(new cmDisallowedCommand(
  255. new cmVariableRequiresCommand, cmPolicies::CMP0035,
  256. "The variable_requires command should not be called; see CMP0035."));
  257. #endif
  258. }