当前位置: 首页 > news >正文

烟台网站建设托管南宁新站seo

烟台网站建设托管,南宁新站seo,网上网络推广,辽宁建设厅查询网站首页一、CMake简介 CMake是一个跨平台的构建工具#xff0c;它可以生成各种操作系统和编译器的构建文件。CMake使用一种基于文本#xff08;CMakeLists.txt#xff09;的语言来描述项目及其依赖关系#xff0c;并生成相应的构建文件。 CMake的基本概念包括#xff1a; 变量…一、CMake简介 CMake是一个跨平台的构建工具它可以生成各种操作系统和编译器的构建文件。CMake使用一种基于文本CMakeLists.txt的语言来描述项目及其依赖关系并生成相应的构建文件。 CMake的基本概念包括 变量用于存储各种信息例如编译器选项、路径等。函数用于执行各种操作例如检查系统版本、生成Makefile等。命令用于执行各种任务例如添加源文件、设置属性等。包用于组织和管理CMake代码。 CMake的使用非常灵活可以根据不同的需求进行定制。它支持多种构建系统包括Makefile、Ninja、Visual Studio等。同时CMake也提供了丰富的API和脚本语言方便用户进行二次开发和集成。 CMake - Upgrade Your Software Build System Getting Started with CMake CMake Reference Documentation — CMake 3.28.0-rc6 Documentation 二、安装CMake Windows 在Windows下安装CMake可以按照以下步骤进行 1. 下载CMake安装包 访问CMake官方网站 https://cmake.org/download/ 下载适用于Windows的CMake安装包。选择适合你的系统版本(32位或64位)的安装包进行下载。 2. 运行安装程序 双击下载好的CMake安装包启动安装程序。 3. 选择安装路径 在安装向导中选择CMake的安装路径。建议将CMake安装在C:\Program Files\CMake目录下以便于在命令行中直接使用。 4. 完成安装 点击“Install”按钮开始安装CMake。安装完成后点击“Finish”按钮退出安装向导。 5. 验证安装 打开命令提示符(按WinR键输入cmd,回车),输入cmake --version按回车键。如果显示出CMake的版本信息说明安装成功。 至此CMake已经成功安装在你的Windows系统中。你可以开始使用CMake进行跨平台项目构建了。 三、CMake-GUI工具 我们一般都是通过“cmake命令行” 来运行CMakeCMake-GUI作为CMake的一个图形化界面工具可以帮助开发者更方便地创建和管理CMake项目。通过使用CMake-GUI开发者可以提高开发效率实现跨平台项目的快速构建。 可以通过windows “cmake-gui”菜单启动 四、CMake 命令行 cmake --help命令用于查看CMake的帮助信息包括各种参数的使用说明和场景。通过使用--help参数用户可以快速了解CMake的基本用法和常用命令。 通过cmake命令行可以做所有CMake-GUI能做的事情并且更方便通过脚本来构建CMake项目。 C:\Users\Laolangcmake --help Usagecmake [options] path-to-sourcecmake [options] path-to-existing-buildcmake [options] -S path-to-source -B path-to-buildSpecify a source directory to (re-)generate a build system for it in the current working directory. Specify an existing build directory to re-generate its build system.Options-S path-to-source Explicitly specify a source directory.-B path-to-build Explicitly specify a build directory.-C initial-cache Pre-load a script to populate the cache.-D var[:type]value Create or update a cmake cache entry.-U globbing_expr Remove matching entries from CMake cache.-G generator-name Specify a build system generator.-T toolset-name Specify toolset name if supported bygenerator.-A platform-name Specify platform name if supported bygenerator.--toolchain file Specify toolchain file[CMAKE_TOOLCHAIN_FILE].--install-prefix directory Specify install directory[CMAKE_INSTALL_PREFIX].-Wdev Enable developer warnings.-Wno-dev Suppress developer warnings.-Werrordev Make developer warnings errors.-Wno-errordev Make developer warnings not errors.-Wdeprecated Enable deprecation warnings.-Wno-deprecated Suppress deprecation warnings.-Werrordeprecated Make deprecated macro and function warningserrors.-Wno-errordeprecated Make deprecated macro and function warningsnot errors.--preset preset,--presetpreset Specify a configure preset.--list-presets[type] List available presets.-E CMake command mode.-L[A][H] List non-advanced cached variables.--fresh Configure a fresh build tree, removing anyexisting cache file.--build dir Build a CMake-generated project binary tree.--install dir Install a CMake-generated project binarytree.--open dir Open generated project in the associatedapplication.-N View mode only.-P file Process script mode.--find-package Legacy pkg-config like mode. Do not use.--graphvizfile Generate graphviz of dependencies, seeCMakeGraphVizOptions.cmake for more.--system-information [file] Dump information about this system.--log-levelERROR|WARNING|NOTICE|STATUS|VERBOSE|DEBUG|TRACE Set the verbosity of messages from CMakefiles. --loglevel is also accepted forbackward compatibility reasons.--log-context Prepend log messages with context, if given--debug-trycompile Do not delete the try_compile build tree.Only useful on one try_compile at a time.--debug-output Put cmake in a debug mode.--debug-find Put cmake find in a debug mode.--debug-find-pkgpkg-name[,...] Limit cmake debug-find to thecomma-separated list of packages--debug-find-varvar-name[,...] Limit cmake debug-find to thecomma-separated list of result variables--trace Put cmake in trace mode.--trace-expand Put cmake in trace mode with variableexpansion.--trace-formathuman|json-v1 Set the output format of the trace.--trace-sourcefile Trace only this CMake file/module. Multipleoptions allowed.--trace-redirectfile Redirect trace output to a file instead ofstderr.--warn-uninitialized Warn about uninitialized values.--no-warn-unused-cli Dont warn about command line options.--check-system-vars Find problems with variable usage in systemfiles.--compile-no-warning-as-error Ignore COMPILE_WARNING_AS_ERROR property andCMAKE_COMPILE_WARNING_AS_ERROR variable.--profiling-formatfmt Output data for profiling CMake scripts.Supported formats: google-trace--profiling-outputfile Select an output path for the profiling dataenabled through --profiling-format.-h,-H,--help,-help,-usage,/? Print usage information and exit.--version,-version,/V [file] Print version number and exit.--help keyword [file] Print help for one keyword and exit.--help-full [file] Print all help manuals and exit.--help-manual man [file] Print one help manual and exit.--help-manual-list [file] List help manuals available and exit.--help-command cmd [file] Print help for one command and exit.--help-command-list [file] List commands with help available and exit.--help-commands [file] Print cmake-commands manual and exit.--help-module mod [file] Print help for one module and exit.--help-module-list [file] List modules with help available and exit.--help-modules [file] Print cmake-modules manual and exit.--help-policy cmp [file] Print help for one policy and exit.--help-policy-list [file] List policies with help available and exit.--help-policies [file] Print cmake-policies manual and exit.--help-property prop [file] Print help for one property and exit.--help-property-list [file] List properties with help available andexit.--help-properties [file] Print cmake-properties manual and exit.--help-variable var [file] Print help for one variable and exit.--help-variable-list [file] List variables with help available and exit.--help-variables [file] Print cmake-variables manual and exit.GeneratorsThe following generators are available on this platform (* marks default): * Visual Studio 17 2022 Generates Visual Studio 2022 project files.Use -A option to specify architecture.Visual Studio 16 2019 Generates Visual Studio 2019 project files.Use -A option to specify architecture.Visual Studio 15 2017 [arch] Generates Visual Studio 2017 project files.Optional [arch] can be Win64 or ARM.Visual Studio 14 2015 [arch] Generates Visual Studio 2015 project files.Optional [arch] can be Win64 or ARM.Visual Studio 12 2013 [arch] Deprecated. Generates Visual Studio 2013project files. Optional [arch] can beWin64 or ARM.Visual Studio 9 2008 [arch] Deprecated. Generates Visual Studio 2008project files. Optional [arch] can beWin64 or IA64.Borland Makefiles Generates Borland makefiles.NMake Makefiles Generates NMake makefiles.NMake Makefiles JOM Generates JOM makefiles.MSYS Makefiles Generates MSYS makefiles.MinGW Makefiles Generates a make file for use withmingw32-make.Green Hills MULTI Generates Green Hills MULTI files(experimental, work-in-progress).Unix Makefiles Generates standard UNIX makefiles.Ninja Generates build.ninja files.Ninja Multi-Config Generates build-Config.ninja files.Watcom WMake Generates Watcom WMake makefiles.CodeBlocks - MinGW Makefiles Generates CodeBlocks project files(deprecated).CodeBlocks - NMake Makefiles Generates CodeBlocks project files(deprecated).CodeBlocks - NMake Makefiles JOM Generates CodeBlocks project files(deprecated).CodeBlocks - Ninja Generates CodeBlocks project files(deprecated).CodeBlocks - Unix Makefiles Generates CodeBlocks project files(deprecated).CodeLite - MinGW Makefiles Generates CodeLite project files(deprecated).CodeLite - NMake Makefiles Generates CodeLite project files(deprecated).CodeLite - Ninja Generates CodeLite project files(deprecated).CodeLite - Unix Makefiles Generates CodeLite project files(deprecated).Eclipse CDT4 - NMake Makefiles Generates Eclipse CDT 4.0 project files(deprecated).Eclipse CDT4 - MinGW Makefiles Generates Eclipse CDT 4.0 project files(deprecated).Eclipse CDT4 - Ninja Generates Eclipse CDT 4.0 project files(deprecated).Eclipse CDT4 - Unix Makefiles Generates Eclipse CDT 4.0 project files(deprecated).Kate - MinGW Makefiles Generates Kate project files (deprecated).Kate - NMake Makefiles Generates Kate project files (deprecated).Kate - Ninja Generates Kate project files (deprecated).Kate - Ninja Multi-Config Generates Kate project files (deprecated).Kate - Unix Makefiles Generates Kate project files (deprecated).Sublime Text 2 - MinGW Makefiles Generates Sublime Text 2 project files(deprecated).Sublime Text 2 - NMake Makefiles Generates Sublime Text 2 project files(deprecated).Sublime Text 2 - Ninja Generates Sublime Text 2 project files(deprecated).Sublime Text 2 - Unix Makefiles Generates Sublime Text 2 project files(deprecated). 常用命令行参数 -G参数 -G是CMake命令行中的一个参数用于指定生成器。 CMake Generator是CMake构建系统中的一个概念它指定了用于生成构建文件的工具。在CMake中Generator是一个字符串它告诉CMake使用哪个工具来生成构建文件(如Makefile或Visual Studio解决方案)。 CMake支持多种生成器每种生成器都有自己的特点和用途。例如Ninja生成器可以提供更快的构建速度而Unix Makefiles生成器则适用于Unix/Linux系统。 使用案例 cmake -G Visual Studio 16 2019 path/to/source这个例子中我们使用-G参数指定了生成器为Visual Studio 16 2019。然后我们将源代码所在的路径传递给CMake命令。这样CMake会使用Visual Studio 16 2019作为生成器来构建项目。 -D参数 -D是CMake命令行中的一个参数用于定义变量。在CMake中变量可以用于存储各种信息例如编译器选项、路径等。使用-D参数可以在命令行中定义这些变量。 使用案例 cmake -D CMAKE_BUILD_TYPEDebug path/to/source这个例子中我们使用-D参数定义了一个名为CMAKE_BUILD_TYPE的变量并将其值设置为Debug。然后我们将源代码所在的路径传递给CMake命令。这样CMake会使用Debug模式来构建项目。 除了CMAKE_BUILD_TYPE,CMake还支持许多其他变量例如CMAKE_INSTALL_PREFIX、CMAKE_CXX_STANDARD等。使用-D参数可以在命令行中定义这些变量从而方便地控制CMake的构建过程。 -B参数 -B是CMake命令行中的一个参数用于指定构建目录。在CMake中构建目录是用来存放生成的构建文件(如Makefile或Visual Studio解决方案)的目录。 使用案例 cmake -B build path/to/source这个例子中我们使用-B参数指定了一个名为build的构建目录。然后我们将源代码所在的路径传递给CMake命令。这样CMake会在build目录下生成构建文件。 默认情况下CMake会在当前目录下生成构建文件。但是有时候我们需要将构建文件放在其他目录下这时就可以使用-B参数来指定构建目录。 -E参数 -E是CMake命令行中的一个参数用于执行CMake脚本中的命令。在CMake中-E参数可以用来执行各种命令例如生成变量、运行脚本等。 使用案例 cmake -E echo Hello, World!这个例子中我们使用-E参数执行了一个简单的echo命令输出了字符串Hello, World!。 cmake -E make_directory build 这个例子中这将在当前目录下创建一个名为build的目录。 cmake -E copy test.txt build/test.txt这个例子中这将将test.txt文件从当前目录复制到build目录中。 除了echo,CMake还支持许多其他命令例如if、foreach、list等。使用-E参数可以在命令行中执行这些命令从而方便地控制CMake的构建过程。 --build参数 --build是CMake命令行中的一个参数用于指定构建目录。在CMake中构建目录是用来存放生成的构建文件(如Makefile或Visual Studio解决方案)的目录。 使用案例 cmake --build path/to/build这个例子中我们使用--build参数指定了一个名为path/to/build的构建目录。然后CMake会在该目录下执行构建过程。 默认情况下CMake会在当前目录下生成构建文件并在当前目录下执行构建过程。但是有时候我们需要将构建文件放在其他目录下或者在其他目录下执行构建过程这时就可以使用--build参数来指定构建目录。 --install参数 --install是CMake命令行中的一个参数用于指定安装目录。在CMake中安装目录是用来存放生成的安装文件(如Windows下的msi文件或Linux下的tar.gz文件)的目录。 使用案例 cmake --install path/to/build --prefixpath/to/install这个例子中我们使用--install参数指定了一个名为path/to/build的构建目录并使用--prefix参数指定了一个名为path/to/install的安装目录。然后CMake会在该安装目录下执行安装过程。 默认情况下CMake会在当前目录下生成安装文件并在当前目录下执行安装过程。但是有时候我们需要将安装文件放在其他目录下或者在其他目录下执行安装过程这时就可以使用--install参数来指定安装目录。 --graphviz参数 --graphviz是CMake命令行中的一个参数用于生成GraphViz图形。在CMake中GraphViz是一种常用的可视化工具可以用来绘制构建文件的依赖关系图等。 使用案例 cmake --graphviz path/to/output.dot这个例子中我们使用--graphviz参数指定了一个名为path/to/output.dot的输出文件。然后CMake会在该文件中生成GraphViz图形。 默认情况下CMake不会生成GraphViz图形。但是有时候我们需要查看构建文件的依赖关系等信息这时就可以使用--graphviz参数来生成GraphViz图形。 --help-variable-list参数 --help-variable-list是CMake命令行中的一个参数用于列出所有可用的变量。在CMake中变量可以用于存储各种信息例如编译器选项、路径等。使用--help-variable-list参数可以查看所有可用的变量及其描述。 使用案例 cmake --help-variable-list这个例子中我们使用--help-variable-list参数来列出所有可用的变量及其描述。CMake会输出一个帮助信息其中包含所有可用的变量及其描述。 默认情况下CMake不会输出帮助信息。但是有时候我们需要查看所有可用的变量及其描述这时就可以使用--help-variable-list参数来列出所有可用的变量及其描述。 --help-variable参数 --help-variable是CMake命令行中的一个参数用于显示指定变量的值。在CMake中变量可以用于存储各种信息例如编译器选项、路径等。使用--help-variable参数可以查看指定变量的值。 使用案例 cmake --help-variable VARIABLE_NAME这个例子中我们使用--help-variable参数来显示名为VARIABLE_NAME的变量的值。CMake会输出该变量的值及其描述。 默认情况下CMake不会输出帮助信息。但是有时候我们需要查看指定变量的值及其描述这时就可以使用--help-variable参数来显示指定变量的值及其描述。 --help-variables参数 --help-variables是CMake命令行中的一个参数用于列出所有可用的变量及其描述。在CMake中变量可以用于存储各种信息例如编译器选项、路径等。使用--help-variables参数可以查看所有可用的变量及其描述。 使用案例 cmake --help-variables这个例子中我们使用--help-variables参数来列出所有可用的变量及其描述。CMake会输出一个帮助信息其中包含所有可用的变量及其描述。 cmake --help-variables cmake_variables.txt 这个例子中我们使用--help-variables参数来输出所有可用的变量及其描述到当前目录的cmake_variables.txt方便查看。 默认情况下CMake不会输出帮助信息。但是有时候我们需要查看所有可用的变量及其描述这时就可以使用--help-variables参数来列出所有可用的变量及其描述。 --help-property、 --help-property-list、--help-properties参数 --help-property是CMake命令行中的一个参数用于显示指定属性的帮助信息。在CMake中属性可以用于存储各种信息例如编译器选项、路径等。使用--help-property参数可以查看指定属性的帮助信息。 使用案例 cmake --help-property VARIABLE_NAME [file]这个例子中我们使用--help-property参数来显示名为VARIABLE_NAME的属性的帮助信息。CMake会输出该属性的描述及其可用选项。如果指定了文件名则将帮助信息输出到该文件中。 除了--help-property,CMake还提供了其他两个与属性相关的参数--help-property-list和--help-properties。 --help-property-list参数用于列出所有具有可用帮助信息的属性并退出。 --help-properties参数用于打印cmake-properties手册并退出。 这些参数可以帮助用户更好地了解CMake的属性及其用法。 -- help-command、--help-command-list、--help-commands参数 --help-command是CMake命令行中的一个参数用于显示指定命令的帮助信息。在CMake中有许多命令可以用于构建和配置项目例如add_executable、configure等。使用--help-command参数可以查看指定命令的帮助信息。 使用案例 cmake --help-command command [file]这个例子中我们使用--help-command参数来显示名为command的命令的帮助信息。CMake会输出该命令的描述及其可用选项。如果指定了文件名则将帮助信息输出到该文件中。 除了--help-command,CMake还提供了其他两个与命令相关的参数--help-list-commands和--help-all-commands。 --help-list-commands参数用于列出所有可用的命令及其简要描述并退出。 --help-all-commands参数用于打印所有可用命令的手册页并退出。 这些参数可以帮助用户更好地了解CMake的命令及其用法。             常用案例 # 指定构建类型为Release cmake -DCMAKE_BUILD_TYPERelease /path/to/source#指定安装目录为/usr/local cmake -DCMAKE_INSTALL_PREFIX/usr/local /path/to/source#指定使用Android NDK作为交叉编译工具链 cmake -DCMAKE_TOOLCHAIN_FILE/path/to/android.toolchain.cmake /path/to/source#指定使用C11标准 cmake -DCMAKE_CXX_FLAGS-stdc11 /path/to/source#定义CMake变量 cmake -DVARvalue /path/to/source#调用CMake内置命令echo cmake -E echo Hello World#指定构建目录 cmake -B /path/to/build /path/to/source#指定使用gcc编译器 cmake -DCMAKE_C_COMPILERgcc -DCMAKE_CXX_COMPILERg /path/to/source#指定构建共享库 cmake -DBUILD_SHARED_LIBSON /path/to/source#指定生成的可执行文件和库文件的输出目录 cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY/path/to/bin -DCMAKE_LIBRARY_OUTPUT_DIRECTORY/path/to/lib /path/to/source指定使用Ninja生成器 cmake -G Ninja /path/to/source指定CMake模块路径 cmake -DCMAKE_MODULE_PATH/path/to/modules /path/to/source指定导出编译命令 cmake -DCMAKE_EXPORT_COMPILE_COMMANDSON /path/to/source指定运行时动态链接库搜索路径 cmake -DCMAKE_INSTALL_RPATH/path/to/lib /path/to/source指定使用Clang编译器且开启优化选项 cmake -DCMAKE_C_COMPILERclang -DCMAKE_CXX_COMPILERclang -DCMAKE_C_FLAGS-O2 -DCMAKE_CXX_FLAGS-O2 /path/to/source指定使用Debug构建类型 cmake -DCMAKE_BUILD_TYPEDebug /path/to/source指定使用Release构建类型并生成Makefile文件 cmake -DCMAKE_BUILD_TYPERelease -G Unix Makefiles /path/to/source指定第三方库安装路径 cmake -DCMAKE_PREFIX_PATH/path/to/third_party /path/to/source指定使用GCC编译器且开启调试信息 cmake -DCMAKE_C_COMPILERgcc -DCMAKE_CXX_COMPILERg -DCMAKE_C_FLAGS-g -DCMAKE_CXX_FLAGS-g /path/to/source 五、总结 通过学习和掌握cmake --help命令行参数我们可以更好地利用CMake进行跨平台项目构建提高开发效率。在实际项目中我们可以根据需要选择合适的参数来满足不同的构建需求。
http://www.hkea.cn/news/14525022/

相关文章:

  • 网站 营销型自建网站赚钱
  • 网站备案照片背景哪个网站上做ppt比较好
  • 免费建网站哪家好江苏水利厅建设网站
  • 苏州做公司邮箱企业网站网站开发培训课程表
  • 深圳市建设工程交易服务网站wordpress哪个模板好用吗
  • 重启wordpress怎么 给自己的网站做优化呢
  • 温州网站排名优化公司口碑好的专业网站建设
  • 怎么自己做网站链接苏州 网站的公司
  • 大型集团网站建设铜铜铜铜铜铜铜铜好大好深色
  • 网站目录扫描辽宁建设工程
  • 手机网站制作视频教程网站制作模板图片
  • 哪些行业没有做网站如何建立自己的小程序
  • 网站制作一个人可以做吗wordpress整站主题
  • 网站类网站开发源代码网络营销策划书1500字
  • 自己的卡盟网站怎么做分站房产怎么创建网站
  • xuzhou网站制作怎么做免费网站如何让百度收录
  • 平安建设宣传音频免费下载网站临沂沂河新区
  • 请简述网站制作流程南漳网站制作
  • 制作网站单页图片怎么制作
  • 郴州网站建设找哪家公司织梦网站优化
  • 学工系统网站建设的意义运城seo
  • 网站建设阶段的推广哪里能找到免费网站
  • 做外贸网站推广什么比较好揭阳企业网站排名多少钱
  • 六安网站线上引流多少钱游戏动漫设计与制作
  • 简述网站开发工作流程wordpress对接易支付宝
  • 七台河做网站济南外贸网站建站
  • icp备案网站接入信息企业网站优化定制
  • 营销型平台网站建设iis建好的网站套用模板
  • 网站后台登录域名页面具有动态效果网站建设
  • 网站文案框架建行官网个人登录