You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

769 lines
28 KiB

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
9 years ago
23 years ago
23 years ago
25 years ago
25 years ago
23 years ago
25 years ago
23 years ago
23 years ago
23 years ago
25 years ago
25 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
23 years ago
25 years ago
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmake_h
  4. #define cmake_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <cstddef>
  7. #include <functional>
  8. #include <map>
  9. #include <memory>
  10. #include <set>
  11. #include <stack>
  12. #include <string>
  13. #include <unordered_set>
  14. #include <utility>
  15. #include <vector>
  16. #include "cmGeneratedFileStream.h"
  17. #include "cmInstalledFile.h"
  18. #include "cmListFileCache.h"
  19. #include "cmMessageType.h"
  20. #include "cmState.h"
  21. #include "cmStateSnapshot.h"
  22. #include "cmStateTypes.h"
  23. #if !defined(CMAKE_BOOTSTRAP)
  24. # include "cm_jsoncpp_value.h"
  25. #endif
  26. class cmExternalMakefileProjectGeneratorFactory;
  27. class cmFileAPI;
  28. class cmFileTimeCache;
  29. class cmGlobalGenerator;
  30. class cmGlobalGeneratorFactory;
  31. class cmMakefile;
  32. class cmMessenger;
  33. class cmVariableWatch;
  34. struct cmDocumentationEntry;
  35. /** \brief Represents a cmake invocation.
  36. *
  37. * This class represents a cmake invocation. It is the top level class when
  38. * running cmake. Most cmake based GUIs should primarily create an instance
  39. * of this class and communicate with it.
  40. *
  41. * The basic process for a GUI is as follows:
  42. *
  43. * -# Create a cmake instance
  44. * -# Set the Home directories, generator, and cmake command. this
  45. * can be done using the Set methods or by using SetArgs and passing in
  46. * command line arguments.
  47. * -# Load the cache by calling LoadCache (duh)
  48. * -# if you are using command line arguments with -D or -C flags then
  49. * call SetCacheArgs (or if for some other reason you want to modify the
  50. * cache), do it now.
  51. * -# Finally call Configure
  52. * -# Let the user change values and go back to step 5
  53. * -# call Generate
  54. * If your GUI allows the user to change the home directories then
  55. * you must at a minimum redo steps 2 through 7.
  56. */
  57. class cmake
  58. {
  59. public:
  60. enum Role
  61. {
  62. RoleInternal, // no commands
  63. RoleScript, // script commands
  64. RoleProject // all commands
  65. };
  66. enum DiagLevel
  67. {
  68. DIAG_IGNORE,
  69. DIAG_WARN,
  70. DIAG_ERROR
  71. };
  72. /** \brief Describes the working modes of cmake */
  73. enum WorkingMode
  74. {
  75. NORMAL_MODE, ///< Cmake runs to create project files
  76. /** \brief Script mode (started by using -P).
  77. *
  78. * In script mode there is no generator and no cache. Also,
  79. * languages are not enabled, so add_executable and things do
  80. * nothing.
  81. */
  82. SCRIPT_MODE,
  83. /** \brief A pkg-config like mode
  84. *
  85. * In this mode cmake just searches for a package and prints the results to
  86. * stdout. This is similar to SCRIPT_MODE, but commands like add_library()
  87. * work too, since they may be used e.g. in exported target files. Started
  88. * via --find-package.
  89. */
  90. FIND_PACKAGE_MODE
  91. };
  92. /** \brief Define log level constants. */
  93. enum LogLevel
  94. {
  95. LOG_UNDEFINED,
  96. LOG_ERROR,
  97. LOG_WARNING,
  98. LOG_NOTICE,
  99. LOG_STATUS,
  100. LOG_VERBOSE,
  101. LOG_DEBUG,
  102. LOG_TRACE
  103. };
  104. /** \brief Define supported trace formats **/
  105. enum TraceFormat
  106. {
  107. TRACE_UNDEFINED,
  108. TRACE_HUMAN,
  109. TRACE_JSON_V1,
  110. };
  111. struct GeneratorInfo
  112. {
  113. std::string name;
  114. std::string baseName;
  115. std::string extraName;
  116. bool supportsToolset;
  117. bool supportsPlatform;
  118. std::vector<std::string> supportedPlatforms;
  119. std::string defaultPlatform;
  120. bool isAlias;
  121. };
  122. struct FileExtensions
  123. {
  124. bool Test(std::string const& ext) const
  125. {
  126. return (this->unordered.find(ext) != this->unordered.end());
  127. }
  128. std::vector<std::string> ordered;
  129. std::unordered_set<std::string> unordered;
  130. };
  131. using InstalledFilesMap = std::map<std::string, cmInstalledFile>;
  132. static const int NO_BUILD_PARALLEL_LEVEL = -1;
  133. static const int DEFAULT_BUILD_PARALLEL_LEVEL = 0;
  134. /// Default constructor
  135. cmake(Role role, cmState::Mode mode);
  136. /// Destructor
  137. ~cmake();
  138. cmake(cmake const&) = delete;
  139. cmake& operator=(cmake const&) = delete;
  140. #if !defined(CMAKE_BOOTSTRAP)
  141. Json::Value ReportVersionJson() const;
  142. Json::Value ReportCapabilitiesJson() const;
  143. #endif
  144. std::string ReportCapabilities() const;
  145. //@{
  146. /**
  147. * Set/Get the home directory (or output directory) in the project. The
  148. * home directory is the top directory of the project. It is the
  149. * path-to-source cmake was run with.
  150. */
  151. void SetHomeDirectory(const std::string& dir);
  152. std::string const& GetHomeDirectory() const;
  153. void SetHomeOutputDirectory(const std::string& dir);
  154. std::string const& GetHomeOutputDirectory() const;
  155. //@}
  156. /**
  157. * Handle a command line invocation of cmake.
  158. */
  159. int Run(const std::vector<std::string>& args)
  160. {
  161. return this->Run(args, false);
  162. }
  163. int Run(const std::vector<std::string>& args, bool noconfigure);
  164. /**
  165. * Run the global generator Generate step.
  166. */
  167. int Generate();
  168. /**
  169. * Configure the cmMakefiles. This routine will create a GlobalGenerator if
  170. * one has not already been set. It will then Call Configure on the
  171. * GlobalGenerator. This in turn will read in an process all the CMakeList
  172. * files for the tree. It will not produce any actual Makefiles, or
  173. * workspaces. Generate does that. */
  174. int Configure();
  175. int ActualConfigure();
  176. //! Break up a line like VAR:type="value" into var, type and value
  177. static bool ParseCacheEntry(const std::string& entry, std::string& var,
  178. std::string& value,
  179. cmStateEnums::CacheEntryType& type);
  180. int LoadCache();
  181. bool LoadCache(const std::string& path);
  182. bool LoadCache(const std::string& path, bool internal,
  183. std::set<std::string>& excludes,
  184. std::set<std::string>& includes);
  185. bool SaveCache(const std::string& path);
  186. bool DeleteCache(const std::string& path);
  187. void PreLoadCMakeFiles();
  188. //! Create a GlobalGenerator
  189. cmGlobalGenerator* CreateGlobalGenerator(const std::string& name);
  190. //! Return the global generator assigned to this instance of cmake
  191. cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
  192. //! Return the global generator assigned to this instance of cmake, const
  193. const cmGlobalGenerator* GetGlobalGenerator() const
  194. {
  195. return this->GlobalGenerator;
  196. }
  197. //! Return the full path to where the CMakeCache.txt file should be.
  198. static std::string FindCacheFile(const std::string& binaryDir);
  199. //! Return the global generator assigned to this instance of cmake
  200. void SetGlobalGenerator(cmGlobalGenerator*);
  201. //! Get the names of the current registered generators
  202. void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
  203. bool includeNamesWithPlatform = true) const;
  204. //! Set the name of the selected generator-specific instance.
  205. void SetGeneratorInstance(std::string const& instance)
  206. {
  207. this->GeneratorInstance = instance;
  208. this->GeneratorInstanceSet = true;
  209. }
  210. //! Set the name of the selected generator-specific platform.
  211. void SetGeneratorPlatform(std::string const& ts)
  212. {
  213. this->GeneratorPlatform = ts;
  214. this->GeneratorPlatformSet = true;
  215. }
  216. //! Set the name of the selected generator-specific toolset.
  217. void SetGeneratorToolset(std::string const& ts)
  218. {
  219. this->GeneratorToolset = ts;
  220. this->GeneratorToolsetSet = true;
  221. }
  222. const std::vector<std::string>& GetSourceExtensions() const
  223. {
  224. return this->SourceFileExtensions.ordered;
  225. }
  226. bool IsSourceExtension(const std::string& ext) const
  227. {
  228. return this->SourceFileExtensions.Test(ext);
  229. }
  230. const std::vector<std::string>& GetHeaderExtensions() const
  231. {
  232. return this->HeaderFileExtensions.ordered;
  233. }
  234. bool IsHeaderExtension(const std::string& ext) const
  235. {
  236. return this->HeaderFileExtensions.Test(ext);
  237. }
  238. const std::vector<std::string>& GetCudaExtensions() const
  239. {
  240. return this->CudaFileExtensions.ordered;
  241. }
  242. bool IsCudaExtension(const std::string& ext) const
  243. {
  244. return this->CudaFileExtensions.Test(ext);
  245. }
  246. const std::vector<std::string>& GetFortranExtensions() const
  247. {
  248. return this->FortranFileExtensions.ordered;
  249. }
  250. bool IsFortranExtension(const std::string& ext) const
  251. {
  252. return this->FortranFileExtensions.Test(ext);
  253. }
  254. // Strips the extension (if present and known) from a filename
  255. std::string StripExtension(const std::string& file) const;
  256. /**
  257. * Given a variable name, return its value (as a string).
  258. */
  259. const char* GetCacheDefinition(const std::string&) const;
  260. //! Add an entry into the cache
  261. void AddCacheEntry(const std::string& key, const char* value,
  262. const char* helpString, int type);
  263. bool DoWriteGlobVerifyTarget() const;
  264. std::string const& GetGlobVerifyScript() const;
  265. std::string const& GetGlobVerifyStamp() const;
  266. void AddGlobCacheEntry(bool recurse, bool listDirectories,
  267. bool followSymlinks, const std::string& relative,
  268. const std::string& expression,
  269. const std::vector<std::string>& files,
  270. const std::string& variable,
  271. cmListFileBacktrace const& bt);
  272. /**
  273. * Get the system information and write it to the file specified
  274. */
  275. int GetSystemInformation(std::vector<std::string>&);
  276. //! Parse environment variables
  277. void LoadEnvironmentPresets();
  278. //! Parse command line arguments
  279. void SetArgs(const std::vector<std::string>& args);
  280. //! Is this cmake running as a result of a TRY_COMPILE command
  281. bool GetIsInTryCompile() const;
  282. void SetIsInTryCompile(bool b);
  283. //! Parse command line arguments that might set cache values
  284. bool SetCacheArgs(const std::vector<std::string>&);
  285. using ProgressCallbackType = std::function<void(const std::string&, float)>;
  286. /**
  287. * Set the function used by GUIs to receive progress updates
  288. * Function gets passed: message as a const char*, a progress
  289. * amount ranging from 0 to 1.0 and client data. The progress
  290. * number provided may be negative in cases where a message is
  291. * to be displayed without any progress percentage.
  292. */
  293. void SetProgressCallback(ProgressCallbackType f);
  294. //! this is called by generators to update the progress
  295. void UpdateProgress(const std::string& msg, float prog);
  296. #if !defined(CMAKE_BOOTSTRAP)
  297. //! Get the variable watch object
  298. cmVariableWatch* GetVariableWatch() { return this->VariableWatch.get(); }
  299. #endif
  300. std::vector<cmDocumentationEntry> GetGeneratorsDocumentation();
  301. //! Set/Get a property of this target file
  302. void SetProperty(const std::string& prop, const char* value);
  303. void AppendProperty(const std::string& prop, const char* value,
  304. bool asString = false);
  305. const char* GetProperty(const std::string& prop);
  306. bool GetPropertyAsBool(const std::string& prop);
  307. //! Get or create an cmInstalledFile instance and return a pointer to it
  308. cmInstalledFile* GetOrCreateInstalledFile(cmMakefile* mf,
  309. const std::string& name);
  310. cmInstalledFile const* GetInstalledFile(const std::string& name) const;
  311. InstalledFilesMap const& GetInstalledFiles() const
  312. {
  313. return this->InstalledFiles;
  314. }
  315. //! Do all the checks before running configure
  316. int DoPreConfigureChecks();
  317. void SetWorkingMode(WorkingMode mode) { this->CurrentWorkingMode = mode; }
  318. WorkingMode GetWorkingMode() { return this->CurrentWorkingMode; }
  319. //! Debug the try compile stuff by not deleting the files
  320. bool GetDebugTryCompile() { return this->DebugTryCompile; }
  321. void DebugTryCompileOn() { this->DebugTryCompile = true; }
  322. /**
  323. * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries
  324. */
  325. int AddCMakePaths();
  326. /**
  327. * Get the file comparison class
  328. */
  329. cmFileTimeCache* GetFileTimeCache() { return this->FileTimeCache.get(); }
  330. bool WasLogLevelSetViaCLI() const { return this->LogLevelWasSetViaCLI; }
  331. //! Get the selected log level for `message()` commands during the cmake run.
  332. LogLevel GetLogLevel() const { return this->MessageLogLevel; }
  333. void SetLogLevel(LogLevel level) { this->MessageLogLevel = level; }
  334. static LogLevel StringToLogLevel(const std::string& levelStr);
  335. static TraceFormat StringToTraceFormat(const std::string& levelStr);
  336. bool HasCheckInProgress() const
  337. {
  338. return !this->CheckInProgressMessages.empty();
  339. }
  340. std::size_t GetCheckInProgressSize() const
  341. {
  342. return this->CheckInProgressMessages.size();
  343. }
  344. std::string GetTopCheckInProgressMessage()
  345. {
  346. auto message = this->CheckInProgressMessages.top();
  347. this->CheckInProgressMessages.pop();
  348. return message;
  349. }
  350. void PushCheckInProgressMessage(std::string message)
  351. {
  352. this->CheckInProgressMessages.emplace(std::move(message));
  353. }
  354. //! Do we want debug output during the cmake run.
  355. bool GetDebugOutput() { return this->DebugOutput; }
  356. void SetDebugOutputOn(bool b) { this->DebugOutput = b; }
  357. //! Should `message` command display context.
  358. bool GetShowLogContext() const { return this->LogContext; }
  359. void SetShowLogContext(bool b) { this->LogContext = b; }
  360. //! Do we want trace output during the cmake run.
  361. bool GetTrace() const { return this->Trace; }
  362. void SetTrace(bool b) { this->Trace = b; }
  363. bool GetTraceExpand() const { return this->TraceExpand; }
  364. void SetTraceExpand(bool b) { this->TraceExpand = b; }
  365. TraceFormat GetTraceFormat() const { return this->TraceFormatVar; }
  366. void SetTraceFormat(TraceFormat f) { this->TraceFormatVar = f; }
  367. void AddTraceSource(std::string const& file)
  368. {
  369. this->TraceOnlyThisSources.push_back(file);
  370. }
  371. std::vector<std::string> const& GetTraceSources() const
  372. {
  373. return this->TraceOnlyThisSources;
  374. }
  375. cmGeneratedFileStream& GetTraceFile() { return this->TraceFile; }
  376. void SetTraceFile(std::string const& file);
  377. void PrintTraceFormatVersion();
  378. bool GetWarnUninitialized() { return this->WarnUninitialized; }
  379. void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
  380. bool GetWarnUnused() { return this->WarnUnused; }
  381. void SetWarnUnused(bool b) { this->WarnUnused = b; }
  382. bool GetWarnUnusedCli() { return this->WarnUnusedCli; }
  383. void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
  384. bool GetCheckSystemVars() { return this->CheckSystemVars; }
  385. void SetCheckSystemVars(bool b) { this->CheckSystemVars = b; }
  386. void MarkCliAsUsed(const std::string& variable);
  387. /** Get the list of configurations (in upper case) considered to be
  388. debugging configurations.*/
  389. std::vector<std::string> GetDebugConfigs();
  390. void SetCMakeEditCommand(std::string const& s)
  391. {
  392. this->CMakeEditCommand = s;
  393. }
  394. std::string const& GetCMakeEditCommand() const
  395. {
  396. return this->CMakeEditCommand;
  397. }
  398. cmMessenger* GetMessenger() const { return this->Messenger.get(); }
  399. /**
  400. * Get the state of the suppression of developer (author) warnings.
  401. * Returns false, by default, if developer warnings should be shown, true
  402. * otherwise.
  403. */
  404. bool GetSuppressDevWarnings() const;
  405. /**
  406. * Set the state of the suppression of developer (author) warnings.
  407. */
  408. void SetSuppressDevWarnings(bool v);
  409. /**
  410. * Get the state of the suppression of deprecated warnings.
  411. * Returns false, by default, if deprecated warnings should be shown, true
  412. * otherwise.
  413. */
  414. bool GetSuppressDeprecatedWarnings() const;
  415. /**
  416. * Set the state of the suppression of deprecated warnings.
  417. */
  418. void SetSuppressDeprecatedWarnings(bool v);
  419. /**
  420. * Get the state of treating developer (author) warnings as errors.
  421. * Returns false, by default, if warnings should not be treated as errors,
  422. * true otherwise.
  423. */
  424. bool GetDevWarningsAsErrors() const;
  425. /**
  426. * Set the state of treating developer (author) warnings as errors.
  427. */
  428. void SetDevWarningsAsErrors(bool v);
  429. /**
  430. * Get the state of treating deprecated warnings as errors.
  431. * Returns false, by default, if warnings should not be treated as errors,
  432. * true otherwise.
  433. */
  434. bool GetDeprecatedWarningsAsErrors() const;
  435. /**
  436. * Set the state of treating developer (author) warnings as errors.
  437. */
  438. void SetDeprecatedWarningsAsErrors(bool v);
  439. /** Display a message to the user. */
  440. void IssueMessage(
  441. MessageType t, std::string const& text,
  442. cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
  443. //! run the --build option
  444. int Build(int jobs, const std::string& dir,
  445. const std::vector<std::string>& targets, const std::string& config,
  446. const std::vector<std::string>& nativeOptions, bool clean,
  447. bool verbose);
  448. //! run the --open option
  449. bool Open(const std::string& dir, bool dryRun);
  450. void UnwatchUnusedCli(const std::string& var);
  451. void WatchUnusedCli(const std::string& var);
  452. cmState* GetState() const { return this->State.get(); }
  453. void SetCurrentSnapshot(cmStateSnapshot const& snapshot)
  454. {
  455. this->CurrentSnapshot = snapshot;
  456. }
  457. cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; }
  458. protected:
  459. void RunCheckForUnusedVariables();
  460. int HandleDeleteCacheVariables(const std::string& var);
  461. using RegisteredGeneratorsVector = std::vector<cmGlobalGeneratorFactory*>;
  462. RegisteredGeneratorsVector Generators;
  463. using RegisteredExtraGeneratorsVector =
  464. std::vector<cmExternalMakefileProjectGeneratorFactory*>;
  465. RegisteredExtraGeneratorsVector ExtraGenerators;
  466. void AddScriptingCommands();
  467. void AddProjectCommands();
  468. void AddDefaultGenerators();
  469. void AddDefaultExtraGenerators();
  470. cmGlobalGenerator* GlobalGenerator = nullptr;
  471. std::map<std::string, DiagLevel> DiagLevels;
  472. std::string GeneratorInstance;
  473. std::string GeneratorPlatform;
  474. std::string GeneratorToolset;
  475. bool GeneratorInstanceSet = false;
  476. bool GeneratorPlatformSet = false;
  477. bool GeneratorToolsetSet = false;
  478. //! read in a cmake list file to initialize the cache
  479. void ReadListFile(const std::vector<std::string>& args,
  480. const std::string& path);
  481. bool FindPackage(const std::vector<std::string>& args);
  482. //! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
  483. /// If it is set, truncate it to 50kb
  484. void TruncateOutputLog(const char* fname);
  485. /**
  486. * Method called to check build system integrity at build time.
  487. * Returns 1 if CMake should rerun and 0 otherwise.
  488. */
  489. int CheckBuildSystem();
  490. void SetDirectoriesFromFile(const std::string& arg);
  491. //! Make sure all commands are what they say they are and there is no
  492. /// macros.
  493. void CleanupCommandsAndMacros();
  494. void GenerateGraphViz(const std::string& fileName) const;
  495. private:
  496. ProgressCallbackType ProgressCallback;
  497. WorkingMode CurrentWorkingMode = NORMAL_MODE;
  498. bool DebugOutput = false;
  499. bool Trace = false;
  500. bool TraceExpand = false;
  501. TraceFormat TraceFormatVar = TRACE_HUMAN;
  502. cmGeneratedFileStream TraceFile;
  503. bool WarnUninitialized = false;
  504. bool WarnUnused = false;
  505. bool WarnUnusedCli = true;
  506. bool CheckSystemVars = false;
  507. std::map<std::string, bool> UsedCliVariables;
  508. std::string CMakeEditCommand;
  509. std::string CXXEnvironment;
  510. std::string CCEnvironment;
  511. std::string CheckBuildSystemArgument;
  512. std::string CheckStampFile;
  513. std::string CheckStampList;
  514. std::string VSSolutionFile;
  515. std::string EnvironmentGenerator;
  516. FileExtensions SourceFileExtensions;
  517. FileExtensions HeaderFileExtensions;
  518. FileExtensions CudaFileExtensions;
  519. FileExtensions FortranFileExtensions;
  520. bool ClearBuildSystem = false;
  521. bool DebugTryCompile = false;
  522. std::unique_ptr<cmFileTimeCache> FileTimeCache;
  523. std::string GraphVizFile;
  524. InstalledFilesMap InstalledFiles;
  525. #if !defined(CMAKE_BOOTSTRAP)
  526. std::unique_ptr<cmVariableWatch> VariableWatch;
  527. std::unique_ptr<cmFileAPI> FileAPI;
  528. #endif
  529. std::unique_ptr<cmState> State;
  530. cmStateSnapshot CurrentSnapshot;
  531. std::unique_ptr<cmMessenger> Messenger;
  532. std::vector<std::string> TraceOnlyThisSources;
  533. LogLevel MessageLogLevel = LogLevel::LOG_STATUS;
  534. bool LogLevelWasSetViaCLI = false;
  535. bool LogContext = false;
  536. std::stack<std::string> CheckInProgressMessages;
  537. void UpdateConversionPathTable();
  538. //! Print a list of valid generators to stderr.
  539. void PrintGeneratorList();
  540. std::unique_ptr<cmGlobalGenerator> EvaluateDefaultGlobalGenerator();
  541. void CreateDefaultGlobalGenerator();
  542. void AppendGlobalGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
  543. void AppendExtraGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
  544. };
  545. #define CMAKE_STANDARD_OPTIONS_TABLE \
  546. { "-S <path-to-source>", "Explicitly specify a source directory." }, \
  547. { "-B <path-to-build>", "Explicitly specify a build directory." }, \
  548. { "-C <initial-cache>", "Pre-load a script to populate the cache." }, \
  549. { "-D <var>[:<type>]=<value>", "Create or update a cmake cache entry." }, \
  550. { "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \
  551. { "-G <generator-name>", "Specify a build system generator." }, \
  552. { "-T <toolset-name>", \
  553. "Specify toolset name if supported by generator." }, \
  554. { "-A <platform-name>", \
  555. "Specify platform name if supported by generator." }, \
  556. { "-Wdev", "Enable developer warnings." }, \
  557. { "-Wno-dev", "Suppress developer warnings." }, \
  558. { "-Werror=dev", "Make developer warnings errors." }, \
  559. { "-Wno-error=dev", "Make developer warnings not errors." }, \
  560. { "-Wdeprecated", "Enable deprecation warnings." }, \
  561. { "-Wno-deprecated", "Suppress deprecation warnings." }, \
  562. { "-Werror=deprecated", \
  563. "Make deprecated macro and function warnings " \
  564. "errors." }, \
  565. { \
  566. "-Wno-error=deprecated", \
  567. "Make deprecated macro and function warnings " \
  568. "not errors." \
  569. }
  570. #define FOR_EACH_C90_FEATURE(F) F(c_function_prototypes)
  571. #define FOR_EACH_C99_FEATURE(F) \
  572. F(c_restrict) \
  573. F(c_variadic_macros)
  574. #define FOR_EACH_C11_FEATURE(F) F(c_static_assert)
  575. #define FOR_EACH_C_FEATURE(F) \
  576. F(c_std_90) \
  577. F(c_std_99) \
  578. F(c_std_11) \
  579. FOR_EACH_C90_FEATURE(F) \
  580. FOR_EACH_C99_FEATURE(F) \
  581. FOR_EACH_C11_FEATURE(F)
  582. #define FOR_EACH_CXX98_FEATURE(F) F(cxx_template_template_parameters)
  583. #define FOR_EACH_CXX11_FEATURE(F) \
  584. F(cxx_alias_templates) \
  585. F(cxx_alignas) \
  586. F(cxx_alignof) \
  587. F(cxx_attributes) \
  588. F(cxx_auto_type) \
  589. F(cxx_constexpr) \
  590. F(cxx_decltype) \
  591. F(cxx_decltype_incomplete_return_types) \
  592. F(cxx_default_function_template_args) \
  593. F(cxx_defaulted_functions) \
  594. F(cxx_defaulted_move_initializers) \
  595. F(cxx_delegating_constructors) \
  596. F(cxx_deleted_functions) \
  597. F(cxx_enum_forward_declarations) \
  598. F(cxx_explicit_conversions) \
  599. F(cxx_extended_friend_declarations) \
  600. F(cxx_extern_templates) \
  601. F(cxx_final) \
  602. F(cxx_func_identifier) \
  603. F(cxx_generalized_initializers) \
  604. F(cxx_inheriting_constructors) \
  605. F(cxx_inline_namespaces) \
  606. F(cxx_lambdas) \
  607. F(cxx_local_type_template_args) \
  608. F(cxx_long_long_type) \
  609. F(cxx_noexcept) \
  610. F(cxx_nonstatic_member_init) \
  611. F(cxx_nullptr) \
  612. F(cxx_override) \
  613. F(cxx_range_for) \
  614. F(cxx_raw_string_literals) \
  615. F(cxx_reference_qualified_functions) \
  616. F(cxx_right_angle_brackets) \
  617. F(cxx_rvalue_references) \
  618. F(cxx_sizeof_member) \
  619. F(cxx_static_assert) \
  620. F(cxx_strong_enums) \
  621. F(cxx_thread_local) \
  622. F(cxx_trailing_return_types) \
  623. F(cxx_unicode_literals) \
  624. F(cxx_uniform_initialization) \
  625. F(cxx_unrestricted_unions) \
  626. F(cxx_user_literals) \
  627. F(cxx_variadic_macros) \
  628. F(cxx_variadic_templates)
  629. #define FOR_EACH_CXX14_FEATURE(F) \
  630. F(cxx_aggregate_default_initializers) \
  631. F(cxx_attribute_deprecated) \
  632. F(cxx_binary_literals) \
  633. F(cxx_contextual_conversions) \
  634. F(cxx_decltype_auto) \
  635. F(cxx_digit_separators) \
  636. F(cxx_generic_lambdas) \
  637. F(cxx_lambda_init_captures) \
  638. F(cxx_relaxed_constexpr) \
  639. F(cxx_return_type_deduction) \
  640. F(cxx_variable_templates)
  641. #define FOR_EACH_CXX_FEATURE(F) \
  642. F(cxx_std_98) \
  643. F(cxx_std_11) \
  644. F(cxx_std_14) \
  645. F(cxx_std_17) \
  646. F(cxx_std_20) \
  647. FOR_EACH_CXX98_FEATURE(F) \
  648. FOR_EACH_CXX11_FEATURE(F) \
  649. FOR_EACH_CXX14_FEATURE(F)
  650. #define FOR_EACH_CUDA_FEATURE(F) \
  651. F(cuda_std_03) \
  652. F(cuda_std_11) \
  653. F(cuda_std_14) \
  654. F(cuda_std_17) \
  655. F(cuda_std_20)
  656. #endif