cmakemain.cxx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. // include these first, otherwise there will be problems on Windows
  11. // with GetCurrentDirectory() being redefined
  12. #ifdef CMAKE_BUILD_WITH_CMAKE
  13. #include "cmDynamicLoader.h"
  14. #include "cmDocumentation.h"
  15. #endif
  16. #include "cmake.h"
  17. #include "cmCacheManager.h"
  18. #include "cmListFileCache.h"
  19. #include "cmakewizard.h"
  20. #include "cmSourceFile.h"
  21. #include "cmGlobalGenerator.h"
  22. #include "cmLocalGenerator.h"
  23. #include "cmMakefile.h"
  24. #ifdef CMAKE_BUILD_WITH_CMAKE
  25. //----------------------------------------------------------------------------
  26. static const char * cmDocumentationName[][3] =
  27. {
  28. {0,
  29. " cmake - Cross-Platform Makefile Generator.", 0},
  30. {0,0,0}
  31. };
  32. //----------------------------------------------------------------------------
  33. static const char * cmDocumentationUsage[][3] =
  34. {
  35. {0,
  36. " cmake [options] <path-to-source>\n"
  37. " cmake [options] <path-to-existing-build>", 0},
  38. {0,0,0}
  39. };
  40. //----------------------------------------------------------------------------
  41. static const char * cmDocumentationDescription[][3] =
  42. {
  43. {0,
  44. "The \"cmake\" executable is the CMake command-line interface. It may "
  45. "be used to configure projects in scripts. Project configuration "
  46. "settings "
  47. "may be specified on the command line with the -D option. The -i option "
  48. "will cause cmake to interactively prompt for such settings.", 0},
  49. CMAKE_STANDARD_INTRODUCTION,
  50. {0,0,0}
  51. };
  52. #define CMAKE_BUILD_OPTIONS \
  53. " <dir> = Project binary directory to be built.\n" \
  54. " --target <tgt> = Build <tgt> instead of default targets.\n" \
  55. " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
  56. " --clean-first = Build target 'clean' first, then build.\n" \
  57. " (To clean only, use --target 'clean'.)\n" \
  58. " -- = Pass remaining options to the native tool.\n"
  59. //----------------------------------------------------------------------------
  60. static const char * cmDocumentationOptions[][3] =
  61. {
  62. CMAKE_STANDARD_OPTIONS_TABLE,
  63. {"-E", "CMake command mode.",
  64. "For true platform independence, CMake provides a list of commands "
  65. "that can be used on all systems. Run with -E help for the usage "
  66. "information. Commands available are: chdir, copy, copy_if_different "
  67. "copy_directory, compare_files, echo, echo_append, environment, "
  68. "make_directory, md5sum, remove_directory, remove, tar, time, "
  69. "touch, touch_nocreate, write_regv, delete_regv, comspec, "
  70. "create_symlink."},
  71. {"-i", "Run in wizard mode.",
  72. "Wizard mode runs cmake interactively without a GUI. The user is "
  73. "prompted to answer questions about the project configuration. "
  74. "The answers are used to set cmake cache values."},
  75. {"-L[A][H]", "List non-advanced cached variables.",
  76. "List cache variables will run CMake and list all the variables from the "
  77. "CMake cache that are not marked as INTERNAL or ADVANCED. This will "
  78. "effectively display current CMake settings, which can be then changed "
  79. "with -D option. Changing some of the variable may result in more "
  80. "variables being created. If A is specified, then it will display also "
  81. "advanced variables. If H is specified, it will also display help for "
  82. "each variable."},
  83. {"--build <dir>", "Build a CMake-generated project binary tree.",
  84. "This abstracts a native build tool's command-line interface with the "
  85. "following options:\n"
  86. CMAKE_BUILD_OPTIONS
  87. "Run cmake --build with no options for quick help."},
  88. {"-N", "View mode only.",
  89. "Only load the cache. Do not actually run configure and generate steps."},
  90. {"-P <file>", "Process script mode.",
  91. "Process the given cmake file as a script written in the CMake language. "
  92. "No configure or generate step is performed and the cache is not"
  93. " modified. If variables are defined using -D, this must be done "
  94. "before the -P argument."},
  95. {"--graphviz=[file]", "Generate graphviz of dependencies.",
  96. "Generate a graphviz input file that will contain all the library and "
  97. "executable dependencies in the project."},
  98. {"--system-information [file]", "Dump information about this system.",
  99. "Dump a wide range of information about the current system. If run "
  100. "from the top of a binary tree for a CMake project it will dump "
  101. "additional information such as the cache, log files etc."},
  102. {"--debug-trycompile", "Do not delete the try compile directories..",
  103. "Do not delete the files and directories created for try_compile calls. "
  104. "This is useful in debugging failed try_compiles. It may however "
  105. "change the results of the try-compiles as old junk from a previous "
  106. "try-compile may cause a different test to either pass or fail "
  107. "incorrectly. This option is best used for one try-compile at a time, "
  108. "and only when debugging." },
  109. {"--debug-output", "Put cmake in a debug mode.",
  110. "Print extra stuff during the cmake run like stack traces with "
  111. "message(send_error ) calls."},
  112. {"--trace", "Put cmake in trace mode.",
  113. "Print a trace of all calls made and from where with "
  114. "message(send_error ) calls."},
  115. {"--help-command cmd [file]", "Print help for a single command and exit.",
  116. "Full documentation specific to the given command is displayed. "
  117. "If a file is specified, the documentation is written into and the output "
  118. "format is determined depending on the filename suffix. Supported are man "
  119. "page, HTML, DocBook and plain text."},
  120. {"--help-command-list [file]", "List available listfile commands and exit.",
  121. "The list contains all commands for which help may be obtained by using "
  122. "the --help-command argument followed by a command name. "
  123. "If a file is specified, the documentation is written into and the output "
  124. "format is determined depending on the filename suffix. Supported are man "
  125. "page, HTML, DocBook and plain text."},
  126. {"--help-commands [file]", "Print help for all commands and exit.",
  127. "Full documentation specific for all current command is displayed."
  128. "If a file is specified, the documentation is written into and the output "
  129. "format is determined depending on the filename suffix. Supported are man "
  130. "page, HTML, DocBook and plain text."},
  131. {"--help-compatcommands [file]", "Print help for compatibility commands. ",
  132. "Full documentation specific for all compatibility commands is displayed."
  133. "If a file is specified, the documentation is written into and the output "
  134. "format is determined depending on the filename suffix. Supported are man "
  135. "page, HTML, DocBook and plain text."},
  136. {"--help-module module [file]", "Print help for a single module and exit.",
  137. "Full documentation specific to the given module is displayed."
  138. "If a file is specified, the documentation is written into and the output "
  139. "format is determined depending on the filename suffix. Supported are man "
  140. "page, HTML, DocBook and plain text."},
  141. {"--help-module-list [file]", "List available modules and exit.",
  142. "The list contains all modules for which help may be obtained by using "
  143. "the --help-module argument followed by a module name. "
  144. "If a file is specified, the documentation is written into and the output "
  145. "format is determined depending on the filename suffix. Supported are man "
  146. "page, HTML, DocBook and plain text."},
  147. {"--help-modules [file]", "Print help for all modules and exit.",
  148. "Full documentation for all modules is displayed. "
  149. "If a file is specified, the documentation is written into and the output "
  150. "format is determined depending on the filename suffix. Supported are man "
  151. "page, HTML, DocBook and plain text."},
  152. {"--help-custom-modules [file]" , "Print help for all custom modules and "
  153. "exit.",
  154. "Full documentation for all custom modules is displayed. "
  155. "If a file is specified, the documentation is written into and the output "
  156. "format is determined depending on the filename suffix. Supported are man "
  157. "page, HTML, DocBook and plain text."},
  158. {"--help-policy cmp [file]",
  159. "Print help for a single policy and exit.",
  160. "Full documentation specific to the given policy is displayed."
  161. "If a file is specified, the documentation is written into and the output "
  162. "format is determined depending on the filename suffix. Supported are man "
  163. "page, HTML, DocBook and plain text."},
  164. {"--help-policies [file]", "Print help for all policies and exit.",
  165. "Full documentation for all policies is displayed."
  166. "If a file is specified, the documentation is written into and the output "
  167. "format is determined depending on the filename suffix. Supported are man "
  168. "page, HTML, DocBook and plain text."},
  169. {"--help-property prop [file]",
  170. "Print help for a single property and exit.",
  171. "Full documentation specific to the given property is displayed."
  172. "If a file is specified, the documentation is written into and the output "
  173. "format is determined depending on the filename suffix. Supported are man "
  174. "page, HTML, DocBook and plain text."},
  175. {"--help-property-list [file]", "List available properties and exit.",
  176. "The list contains all properties for which help may be obtained by using "
  177. "the --help-property argument followed by a property name. If a file is "
  178. "specified, the help is written into it."
  179. "If a file is specified, the documentation is written into and the output "
  180. "format is determined depending on the filename suffix. Supported are man "
  181. "page, HTML, DocBook and plain text."},
  182. {"--help-properties [file]", "Print help for all properties and exit.",
  183. "Full documentation for all properties is displayed."
  184. "If a file is specified, the documentation is written into and the output "
  185. "format is determined depending on the filename suffix. Supported are man "
  186. "page, HTML, DocBook and plain text."},
  187. {"--help-variable var [file]",
  188. "Print help for a single variable and exit.",
  189. "Full documentation specific to the given variable is displayed."
  190. "If a file is specified, the documentation is written into and the output "
  191. "format is determined depending on the filename suffix. Supported are man "
  192. "page, HTML, DocBook and plain text."},
  193. {"--help-variable-list [file]", "List documented variables and exit.",
  194. "The list contains all variables for which help may be obtained by using "
  195. "the --help-variable argument followed by a variable name. If a file is "
  196. "specified, the help is written into it."
  197. "If a file is specified, the documentation is written into and the output "
  198. "format is determined depending on the filename suffix. Supported are man "
  199. "page, HTML, DocBook and plain text."},
  200. {"--help-variables [file]", "Print help for all variables and exit.",
  201. "Full documentation for all variables is displayed."
  202. "If a file is specified, the documentation is written into and the output "
  203. "format is determined depending on the filename suffix. Supported are man "
  204. "page, HTML, DocBook and plain text."},
  205. {0,0,0}
  206. };
  207. //----------------------------------------------------------------------------
  208. static const char * cmDocumentationSeeAlso[][3] =
  209. {
  210. {0, "ccmake", 0},
  211. {0, "cpack", 0},
  212. {0, "ctest", 0},
  213. {0, "cmakecommands", 0},
  214. {0, "cmakecompat", 0},
  215. {0, "cmakemodules", 0},
  216. {0, "cmakeprops", 0},
  217. {0, "cmakevars", 0},
  218. {0, 0, 0}
  219. };
  220. //----------------------------------------------------------------------------
  221. static const char * cmDocumentationNOTE[][3] =
  222. {
  223. {0,
  224. "CMake no longer configures a project when run with no arguments. "
  225. "In order to configure the project in the current directory, run\n"
  226. " cmake .", 0},
  227. {0,0,0}
  228. };
  229. #endif
  230. int do_cmake(int ac, char** av);
  231. static int do_build(int ac, char** av);
  232. static cmMakefile* cmakemainGetMakefile(void *clientdata)
  233. {
  234. cmake* cm = (cmake *)clientdata;
  235. if(cm && cm->GetDebugOutput())
  236. {
  237. cmGlobalGenerator* gg=cm->GetGlobalGenerator();
  238. if (gg)
  239. {
  240. cmLocalGenerator* lg=gg->GetCurrentLocalGenerator();
  241. if (lg)
  242. {
  243. cmMakefile* mf = lg->GetMakefile();
  244. return mf;
  245. }
  246. }
  247. }
  248. return 0;
  249. }
  250. static std::string cmakemainGetStack(void *clientdata)
  251. {
  252. std::string msg;
  253. cmMakefile* mf=cmakemainGetMakefile(clientdata);
  254. if (mf)
  255. {
  256. msg = mf->GetListFileStack();
  257. if (!msg.empty())
  258. {
  259. msg = "\n Called from: " + msg;
  260. }
  261. }
  262. return msg;
  263. }
  264. static void cmakemainErrorCallback(const char* m, const char*, bool&,
  265. void *clientdata)
  266. {
  267. std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
  268. }
  269. static void cmakemainProgressCallback(const char *m, float prog,
  270. void* clientdata)
  271. {
  272. cmMakefile* mf = cmakemainGetMakefile(clientdata);
  273. std::string dir;
  274. if ((mf) && (strstr(m, "Configuring")==m) && (prog<0))
  275. {
  276. dir = " ";
  277. dir += mf->GetCurrentDirectory();
  278. }
  279. else if ((mf) && (strstr(m, "Generating")==m))
  280. {
  281. dir = " ";
  282. dir += mf->GetCurrentOutputDirectory();
  283. }
  284. if ((prog < 0) || (!dir.empty()))
  285. {
  286. std::cout << "-- " << m << dir << cmakemainGetStack(clientdata)<<std::endl;
  287. }
  288. std::cout.flush();
  289. }
  290. int main(int ac, char** av)
  291. {
  292. cmSystemTools::EnableMSVCDebugHook();
  293. cmSystemTools::FindExecutableDirectory(av[0]);
  294. if(ac > 1 && strcmp(av[1], "--build") == 0)
  295. {
  296. return do_build(ac, av);
  297. }
  298. int ret = do_cmake(ac, av);
  299. #ifdef CMAKE_BUILD_WITH_CMAKE
  300. cmDynamicLoader::FlushCache();
  301. #endif
  302. return ret;
  303. }
  304. int do_cmake(int ac, char** av)
  305. {
  306. int nocwd = 0;
  307. if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
  308. {
  309. std::cerr << "Current working directory cannot be established."
  310. << std::endl;
  311. nocwd = 1;
  312. }
  313. #ifdef CMAKE_BUILD_WITH_CMAKE
  314. cmDocumentation doc;
  315. if(doc.CheckOptions(ac, av, "-E") || nocwd)
  316. {
  317. // Construct and print requested documentation.
  318. cmake hcm;
  319. hcm.AddCMakePaths();
  320. doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_ROOT"));
  321. // the command line args are processed here so that you can do
  322. // -DCMAKE_MODULE_PATH=/some/path and have this value accessible here
  323. std::vector<std::string> args;
  324. for(int i =0; i < ac; ++i)
  325. {
  326. args.push_back(av[i]);
  327. }
  328. hcm.SetCacheArgs(args);
  329. const char* modulePath = hcm.GetCacheDefinition("CMAKE_MODULE_PATH");
  330. if (modulePath)
  331. {
  332. doc.SetCMakeModulePath(modulePath);
  333. }
  334. std::vector<cmDocumentationEntry> commands;
  335. std::vector<cmDocumentationEntry> policies;
  336. std::vector<cmDocumentationEntry> compatCommands;
  337. std::vector<cmDocumentationEntry> generators;
  338. std::map<std::string,cmDocumentationSection *> propDocs;
  339. hcm.GetPolicyDocumentation(policies);
  340. hcm.GetCommandDocumentation(commands, true, false);
  341. hcm.GetCommandDocumentation(compatCommands, false, true);
  342. hcm.GetPropertiesDocumentation(propDocs);
  343. hcm.GetGeneratorDocumentation(generators);
  344. doc.SetName("cmake");
  345. doc.SetSection("Name",cmDocumentationName);
  346. doc.SetSection("Usage",cmDocumentationUsage);
  347. doc.SetSection("Description",cmDocumentationDescription);
  348. doc.AppendSection("Generators",generators);
  349. doc.PrependSection("Options",cmDocumentationOptions);
  350. doc.SetSection("Commands",commands);
  351. doc.SetSection("Policies",policies);
  352. doc.AppendSection("Compatibility Commands",compatCommands);
  353. doc.SetSections(propDocs);
  354. cmDocumentationEntry e;
  355. e.Brief =
  356. "variables defined by cmake, that give information about the project, "
  357. "and cmake";
  358. doc.PrependSection("Variables that Provide Information",e);
  359. doc.SetSeeAlsoList(cmDocumentationSeeAlso);
  360. int result = doc.PrintRequestedDocumentation(std::cout)? 0:1;
  361. // If we were run with no arguments, but a CMakeLists.txt file
  362. // exists, the user may have been trying to use the old behavior
  363. // of cmake to build a project in-source. Print a message
  364. // explaining the change to standard error and return an error
  365. // condition in case the program is running from a script.
  366. if((ac == 1) && cmSystemTools::FileExists("CMakeLists.txt"))
  367. {
  368. doc.ClearSections();
  369. doc.SetSection("NOTE", cmDocumentationNOTE);
  370. doc.Print(cmDocumentation::UsageForm, std::cerr);
  371. return 1;
  372. }
  373. return result;
  374. }
  375. #else
  376. if ( nocwd || ac == 1 )
  377. {
  378. std::cout <<
  379. "Bootstrap CMake should not be used outside CMake build process."
  380. << std::endl;
  381. return 0;
  382. }
  383. #endif
  384. bool wiz = false;
  385. bool sysinfo = false;
  386. bool command = false;
  387. bool list_cached = false;
  388. bool list_all_cached = false;
  389. bool list_help = false;
  390. bool view_only = false;
  391. bool script_mode = false;
  392. std::vector<std::string> args;
  393. for(int i =0; i < ac; ++i)
  394. {
  395. if(strcmp(av[i], "-i") == 0)
  396. {
  397. wiz = true;
  398. }
  399. else if(!command && strcmp(av[i], "--system-information") == 0)
  400. {
  401. sysinfo = true;
  402. }
  403. // if command has already been set, then
  404. // do not eat the -E
  405. else if (!command && strcmp(av[i], "-E") == 0)
  406. {
  407. command = true;
  408. }
  409. else if (!command && strcmp(av[i], "-N") == 0)
  410. {
  411. view_only = true;
  412. }
  413. else if (!command && strcmp(av[i], "-L") == 0)
  414. {
  415. list_cached = true;
  416. }
  417. else if (!command && strcmp(av[i], "-LA") == 0)
  418. {
  419. list_all_cached = true;
  420. }
  421. else if (!command && strcmp(av[i], "-LH") == 0)
  422. {
  423. list_cached = true;
  424. list_help = true;
  425. }
  426. else if (!command && strcmp(av[i], "-LAH") == 0)
  427. {
  428. list_all_cached = true;
  429. list_help = true;
  430. }
  431. else if (!command && strncmp(av[i], "-P", strlen("-P")) == 0)
  432. {
  433. if ( i == ac -1 )
  434. {
  435. cmSystemTools::Error("No script specified for argument -P");
  436. }
  437. else
  438. {
  439. script_mode = true;
  440. args.push_back(av[i]);
  441. i++;
  442. args.push_back(av[i]);
  443. }
  444. }
  445. else
  446. {
  447. args.push_back(av[i]);
  448. }
  449. }
  450. if(command)
  451. {
  452. int ret = cmake::ExecuteCMakeCommand(args);
  453. return ret;
  454. }
  455. if (wiz)
  456. {
  457. cmakewizard wizard;
  458. return wizard.RunWizard(args);
  459. }
  460. if (sysinfo)
  461. {
  462. cmake cm;
  463. int ret = cm.GetSystemInformation(args);
  464. return ret;
  465. }
  466. cmake cm;
  467. cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
  468. cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
  469. cm.SetScriptMode(script_mode);
  470. int res = cm.Run(args, view_only);
  471. if ( list_cached || list_all_cached )
  472. {
  473. cmCacheManager::CacheIterator it =
  474. cm.GetCacheManager()->GetCacheIterator();
  475. std::cout << "-- Cache values" << std::endl;
  476. for ( it.Begin(); !it.IsAtEnd(); it.Next() )
  477. {
  478. cmCacheManager::CacheEntryType t = it.GetType();
  479. if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
  480. t != cmCacheManager::UNINITIALIZED )
  481. {
  482. bool advanced = it.PropertyExists("ADVANCED");
  483. if ( list_all_cached || !advanced)
  484. {
  485. if ( list_help )
  486. {
  487. std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl;
  488. }
  489. std::cout << it.GetName() << ":" <<
  490. cmCacheManager::TypeToString(it.GetType())
  491. << "=" << it.GetValue() << std::endl;
  492. if ( list_help )
  493. {
  494. std::cout << std::endl;
  495. }
  496. }
  497. }
  498. }
  499. }
  500. // Always return a non-negative value. Windows tools do not always
  501. // interpret negative return values as errors.
  502. if(res != 0)
  503. {
  504. return 1;
  505. }
  506. else
  507. {
  508. return 0;
  509. }
  510. }
  511. //----------------------------------------------------------------------------
  512. static int do_build(int ac, char** av)
  513. {
  514. #ifndef CMAKE_BUILD_WITH_CMAKE
  515. std::cerr << "This cmake does not support --build\n";
  516. return -1;
  517. #else
  518. std::string target;
  519. std::string config = "Debug";
  520. std::string dir;
  521. std::vector<std::string> nativeOptions;
  522. bool clean = false;
  523. enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative};
  524. Doing doing = DoingDir;
  525. for(int i=2; i < ac; ++i)
  526. {
  527. if(doing == DoingNative)
  528. {
  529. nativeOptions.push_back(av[i]);
  530. }
  531. else if(strcmp(av[i], "--target") == 0)
  532. {
  533. doing = DoingTarget;
  534. }
  535. else if(strcmp(av[i], "--config") == 0)
  536. {
  537. doing = DoingConfig;
  538. }
  539. else if(strcmp(av[i], "--clean-first") == 0)
  540. {
  541. clean = true;
  542. doing = DoingNone;
  543. }
  544. else if(strcmp(av[i], "--") == 0)
  545. {
  546. doing = DoingNative;
  547. }
  548. else
  549. {
  550. switch (doing)
  551. {
  552. case DoingDir:
  553. dir = av[i];
  554. doing = DoingNone;
  555. break;
  556. case DoingTarget:
  557. target = av[i];
  558. doing = DoingNone;
  559. break;
  560. case DoingConfig:
  561. config = av[i];
  562. doing = DoingNone;
  563. break;
  564. default:
  565. std::cerr << "Unknown argument " << av[i] << std::endl;
  566. dir = "";
  567. break;
  568. }
  569. }
  570. }
  571. if(dir.empty())
  572. {
  573. std::cerr <<
  574. "Usage: cmake --build <dir> [options] [-- [native-options]]\n"
  575. "Options:\n"
  576. CMAKE_BUILD_OPTIONS
  577. ;
  578. return 1;
  579. }
  580. // Hack for vs6 that passes ".\Debug" as "$(IntDir)" value:
  581. //
  582. if (cmSystemTools::StringStartsWith(config.c_str(), ".\\"))
  583. {
  584. config = config.substr(2);
  585. }
  586. cmake cm;
  587. return cm.Build(dir, target, config, nativeOptions, clean);
  588. #endif
  589. }