网站建设模式有哪些,嘉兴网站制作套餐,给网站做认证,凯里建设局网站1. add_execuble
CMake基础教程#xff08;24#xff09;add_executable生成目标可执行文件 CMake中add_executable的使用
CMake中的add_executable命令用于使用指定的源文件向项目(project)添加可执行文件#xff0c;其格式如下#xff1a;
add_executable(name24add_executable生成目标可执行文件 CMake中add_executable的使用
CMake中的add_executable命令用于使用指定的源文件向项目(project)添加可执行文件其格式如下
add_executable(name [WIN32] [MACOSX_BUNDLE][EXCLUDE_FROM_ALL][source1] [source2 ...]) # Normal Executables
add_executable(name IMPORTED [GLOBAL]) # Imported Executables
add_executable(name ALIAS target) # Alias Executables这里我们用到 Normal Executables这种用法Normal Executables:添加一个名为的可执行目标(executable target)该目标将从命令调用中列出的源文件中构建(built)。对应于逻辑目标名称并且必须在项目中全局唯一(globally unique).生成的可执行文件的实际文件名是基于本机平台(native platform)的约定构建的(例如.exe或仅). add_executable的源参数可以使用语法为$…的generator expressions。 如果以后使用target_sources命令添加源文件则可以省略这些源文件。 默认情况下将在与调用命令的源树目录相对应的构建树目录中创建可执行文件(the executable file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked)。可以使用RUNTIME_OUTPUT_DIRECTORY目标属性更改此位置。可以使用OUTPUT_NAME目标属性更改到最终文件名。 如果给定了WIN32,则将在创建的目标上设置WIN32_EXECUTABLE属性. 如果给出了MACOSX_BUNDLE则将在创建的目标上设置相应的属性。 如果给出了EXCLUDE_FROM_ALL则将在创建的目标上设置相应的属性。 示例
#可执行目标文件名称为helloworld
add_executable(helloworld src/hello_world.cpp)