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

网站开发的职业规划asp网站开发招聘

网站开发的职业规划,asp网站开发招聘,wordpress 每页文章数量,跨境电商到什么网站做目录 一、变量相关命令 1. 定义变量 2. 设置C标准 3. 设置输出路径 二、文件相关命令 1. file 命令 2. aux_source_directory 命令 2. include_directories 命令 三、字符串相关命令 1. 字符串输出 2. 字符串拼接 3. 字符串移除 前情提示#xff1a;【Make编译控制 …目录 一、变量相关命令 1. 定义变量 2. 设置C标准 3. 设置输出路径 二、文件相关命令 1. file 命令 2. aux_source_directory 命令 2. include_directories 命令 三、字符串相关命令 1. 字符串输出 2. 字符串拼接 3. 字符串移除 前情提示【Make编译控制 06】CMake初步使用-CSDN博客 一、变量相关命令 1. 定义变量 在CMake初步使用的例子中出现了3个源文件假设这3个源文件需要被反复使用那么每次都直接将这3个源文件名称都列出来会很麻烦此时我们可以定义一个变量将多个源文件的名称作为一个字符串变量存储起来在CMake里面定义变量需要 set 关键字。 # SET 指令的语法是 # [] 中的参数为可选项, 如不需要可以不写 SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]]) # set(SRC_LIST add.cpp;sub.cpp;main.cpp) set(SRC_LIST add.cpp sub.cpp main.cpp) add_executable(math.exe ${SRC_LIST})# 与 Makefile 不同是取变量的值只能用 ${} 2. 设置C标准 # C标准对应有一宏叫做DCMAKE_CXX_STANDARD。 # 在CMake中想要指定C标准有两种方式# 1. 在 CMakeLists.txt 中通过 set 命令指定 # -stdc11 set(CMAKE_CXX_STANDARD 11)# 2. 在执行 cmake 命令的时候指定出这个宏的值 # cmake CMakeLists.txt文件路径 -DCMAKE_CXX_STANDARD11 3. 设置输出路径 # 在CMake中指定可执行程序输出的路径也对应一个宏叫做EXECUTABLE_OUTPUT_PATHset(HOME /root/gitee/Test/Make_Learn/10_test) set(EXECUTABLE_OUTPUT_PATH ${HOME}/bin) # 第一行定义一个变量用于存储一个绝对路径 # 第二行将拼接好的路径值设置给EXECUTABLE_OUTPUT_PATH宏 # 如果这个路径中的子目录不存在会自动生成# 由于可执行程序是基于 cmake 命令生成的 makefile 文件然后再执行 make 命令得到的 # 所以如果此处指定可执行程序生成路径的时候使用的是相对路径 ./xxx/xxx # 那么这个路径中的 ./ 对应的就是 makefile 文件所在的那个目录。 (base) [rootlocalhost build]# cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c -- Check for working CXX compiler: /usr/bin/c -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# make Scanning dependencies of target math.exe [ 33%] Building CXX object CMakeFiles/math.exe.dir/add.cpp.o [ 66%] Building CXX object CMakeFiles/math.exe.dir/sub.cpp.o [100%] Building CXX object CMakeFiles/math.exe.dir/main.cpp.o Linking CXX executable ../bin/math.exe [100%] Built target math.exe (base) [rootlocalhost build]# cd .. (base) [rootlocalhost 10_test]# ls add.cpp add.h bin build CMakeLists.txt main.cpp sub.cpp sub.h (base) [rootlocalhost 10_test]# ./bin/math.exe 10 5 15 10 - 5 5 (base) [rootlocalhost 10_test]# 二、文件相关命令 1. file 命令 如果一个项目里边的源文件很多在编写CMakeLists.txt文件的时候不可能将项目目录的各个文件一一罗列出来这样太麻烦也不现实。 所以我们可以通过 CMake 提供给我们的搜索文件命令快速地获得某个路径下的所有源文件。 file(GLOB/GLOB_RECURSE 变量名 要搜索的文件路径及文件类型) # GLOB: 将指定目录下搜索到的满足条件的所有文件名生成一个列表并将其存储到变量中。 # GLOB_RECURSE递归搜索指定目录将搜索到的满足条件的文件名生成一个列表并将其存储到变量中。 # CMakeLists.txt 文件cmake_minimum_required(VERSION 2.8) project(MATH)file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)add_executable(math.exe ${SRC_LIST})set(CMAKE_CXX_STANDARD 11)set(HOME /root/gitee/Test/Make_Learn/10_test) set(EXECUTABLE_OUTPUT_PATH ${HOME}/bin) (base) [rootlocalhost build]# cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c -- Check for working CXX compiler: /usr/bin/c -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# make Scanning dependencies of target math.exe [ 33%] Building CXX object CMakeFiles/math.exe.dir/add.o [ 66%] Building CXX object CMakeFiles/math.exe.dir/main.o [100%] Building CXX object CMakeFiles/math.exe.dir/sub.o Linking CXX executable ../bin/math.exe [100%] Built target math.exe (base) [rootlocalhost build]# ../bin/math.exe 10 5 15 10 - 5 5 (base) [rootlocalhost build]# 2. aux_source_directory 命令 aux_source_directory( dir variable ) # dir要搜索的目录 # variable将从dir目录下搜索到的源文件列表存储到该变量中 # 相比于 file 命令aux_source_directory 命令可以自动选择源文件 # CMakeLists.txt 文件cmake_minimum_required(VERSION 2.8) project(MATH)aux_source_directory(${PROJECT_SOURCE_DIR} SRC_LIST) # PROJECT_SOURCE_DIR 宏表示的路径是使用 cmake 命令时后面跟随的路径 # CMAKE_CURRENT_SOURCE_DIR 宏表示的路径是 CMakeLists.txt 文件的路径 # PROJECT_SOURCE_DIR 和 CMAKE_CURRENT_SOURCE_DIR 是同一个路径add_executable(math.exe ${SRC_LIST})set(CMAKE_CXX_STANDARD 11)set(HOME /root/gitee/Test/Make_Learn/10_test) set(EXECUTABLE_OUTPUT_PATH ${HOME}/bin)(base) [rootlocalhost build]# cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c -- Check for working CXX compiler: /usr/bin/c -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# make Scanning dependencies of target math.exe [ 33%] Building CXX object CMakeFiles/math.exe.dir/add.o [ 66%] Building CXX object CMakeFiles/math.exe.dir/main.o [100%] Building CXX object CMakeFiles/math.exe.dir/sub.o Linking CXX executable ../bin/math.exe [100%] Built target math.exe (base) [rootlocalhost build]# ../bin/math.exe 10 5 15 10 - 5 5 (base) [rootlocalhost build]# 2. include_directories 命令 在编译项目源文件的时候如果源文件和其对应的头文件不在同一个目录下那么就需要将源文件对应的头文件路径指定出来这样才能保证在编译过程中编译器能够找到这些头文件并顺利通过编译。 include_directories(headpath) # 将项目代码存储在如下路径(base) [rootlocalhost 10_test]# tree . . ├── build ├── CMakeLists.txt ├── include │ ├── add.h │ └── sub.h └── src├── add.cpp├── main.cpp└── sub.cpp3 directories, 6 files (base) [rootlocalhost 10_test]# # CMakeLists.txt 文件cmake_minimum_required(VERSION 2.8) project(MATH)aux_source_directory(${CMAKE_SOURCE_DIR}/src SRC_LIST) include_directories(${PROJECT_SOURCE_DIR}/include) add_executable(math.exe ${SRC_LIST})set(CMAKE_CXX_STANDARD 11)set(HOME /root/gitee/Test/Make_Learn/10_test) set(EXECUTABLE_OUTPUT_PATH ${HOME}/bin) (base) [rootlocalhost 10_test]# tree . . ├── build ├── CMakeLists.txt ├── include │ ├── add.h │ └── sub.h └── src├── add.cpp├── main.cpp└── sub.cpp3 directories, 6 files (base) [rootlocalhost 10_test]# cd build/ (base) [rootlocalhost build]# cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c -- Check for working CXX compiler: /usr/bin/c -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# make Scanning dependencies of target math.exe [ 33%] Building CXX object CMakeFiles/math.exe.dir/src/add.o [ 66%] Building CXX object CMakeFiles/math.exe.dir/src/main.o [100%] Building CXX object CMakeFiles/math.exe.dir/src/sub.o Linking CXX executable ../bin/math.exe [100%] Built target math.exe (base) [rootlocalhost build]# ../bin/math.exe 10 5 15 10 - 5 5 (base) [rootlocalhost build]# 三、字符串相关命令 1. 字符串输出 # message 命令可输出字符串常用于调试message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR] message to display ...) # (无) 重要消息 # STATUS 非重要消息 # WARNINGCMake 警告, 会继续执行 # AUTHOR_WARNINGCMake 警告 (dev), 会继续执行 # SEND_ERRORCMake 错误, 继续执行但是会跳过生成的步骤 # FATAL_ERRORCMake 错误, 终止所有处理过程# CMakeLists.txt 文件cmake_minimum_required(VERSION 2.8)message(hello cmake) message(STATUS hello cmake status) message(WARNING hello cmake warning) message(FATAL_ERROR hello cmake faltal_error) message(STATUS hello cmake status) (base) [rootlocalhost build]# cmake .. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c -- Check for working CXX compiler: /usr/bin/c -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done hello cmake -- hello cmake status CMake Warning at CMakeLists.txt:3 (message):hello cmake warningCMake Error at CMakeLists.txt:4 (message):hello cmake faltal_error-- Configuring incomplete, errors occurred! See also /root/gitee/Test/Make_Learn/10_test/build/CMakeFiles/CMakeOutput.log. (base) [rootlocalhost build]# 2. 字符串拼接 有时候项目中的源文件并不一定都在同一个目录中但是这些源文件最终却需要一起进行编译来生成最终的可执行文件或者库文件。如果我们通过file命令对各个目录下的源文件进行搜索最后还需要做一个字符串拼接的操作关于字符串拼接可以使用 set 命令也或 list 命令。 # 方式1通过 set 进行字符串拼接 # set(变量名1 ${变量名1} ${变量名2} ...) # 关于上面的命令其实就是将从第二个参数开始往后所有的字符串进行拼接 # 最后将结果存储到第一个参数中如果第一个参数中原来有数据会对原数据就行覆盖。cmake_minimum_required(VERSION 2.8)file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/*cpp) file(GLOB INC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) set(ALL_FILES ${SRC_LIST} ${INC_LIST})message(STATUS SRC_LIST: ${SRC_LIST}) message(STATUS INC_LIST: ${INC_LIST}) message(STATUS ALL_FILES: ${ALL_FILES})(base) [rootlocalhost build]# cmake .. -- SRC_LIST: /root/gitee/Test/Make_Learn/10_test/src/add.cpp;/root/gitee/Test/Make_Learn/10_test/src/main.cpp;/root/gitee/Test/Make_Learn/10_test/src/sub.cpp -- INC_LIST: /root/gitee/Test/Make_Learn/10_test/include/add.h;/root/gitee/Test/Make_Learn/10_test/include/sub.h -- ALL_FILES: /root/gitee/Test/Make_Learn/10_test/src/add.cpp;/root/gitee/Test/Make_Learn/10_test/src/main.cpp;/root/gitee/Test/Make_Learn/10_test/src/sub.cpp;/root/gitee/Test/Make_Learn/10_test/include/add.h;/root/gitee/Test/Make_Learn/10_test/include/sub.h -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# # 方式2通过 list 进行字符串拼接 # list(APPEND list [element ...]) # list命令的功能比set要强大字符串拼接只是它的其中一个功能 # 所以需要在它第一个参数的位置指定出我们要做的操作 # APPEND表示进行数据追加后边的参数和set就一样了。cmake_minimum_required(VERSION 2.8)file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/*cpp) file(GLOB INC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) # set(ALL_FILES ${SRC_LIST} ${INC_LIST}) list(APPEND ALL_FILES ${INC_LIST} ${SRC_LIST})message(STATUS SRC_LIST: ${SRC_LIST}) message(STATUS INC_LIST: ${INC_LIST}) message(STATUS ALL_FILES: ${ALL_FILES}) (base) [rootlocalhost build]# cmake .. -- SRC_LIST: /root/gitee/Test/Make_Learn/10_test/src/add.cpp;/root/gitee/Test/Make_Learn/10_test/src/main.cpp;/root/gitee/Test/Make_Learn/10_test/src/sub.cpp -- INC_LIST: /root/gitee/Test/Make_Learn/10_test/include/add.h;/root/gitee/Test/Make_Learn/10_test/include/sub.h -- ALL_FILES: /root/gitee/Test/Make_Learn/10_test/include/add.h;/root/gitee/Test/Make_Learn/10_test/include/sub.h;/root/gitee/Test/Make_Learn/10_test/src/add.cpp;/root/gitee/Test/Make_Learn/10_test/src/main.cpp;/root/gitee/Test/Make_Learn/10_test/src/sub.cpp -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]# 3. 字符串移除 我们在通过file搜索某个目录就得到了该目录下所有的源文件但是其中有些源文件并不是我们所需要的比如在打包生成库的时候我们就不需要包含有主函数的源文件。 (base) [rootlocalhost 10_test]# tree . . ├── build ├── CMakeLists.txt ├── include │ ├── add.h │ └── sub.h └── src├── add.cpp├── main.cpp└── sub.cpp3 directories, 6 files (base) [rootlocalhost 10_test]# 想要实现字符串的移除也是同构 list 命令。 list(REMOVE_ITEM list value [value ...]) 命令原型可以看到删除和追加数据类似只不过是第一个参数变成了REMOVE_ITEM。 cmake_minimum_required(VERSION 2.8)file(GLOB SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/*cpp)list(REMOVE_ITEM SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)message(STATUS SRC_LIST: ${SRC_LIST}) (base) [rootlocalhost build]# cmake .. -- SRC_LIST: /root/gitee/Test/Make_Learn/10_test/src/add.cpp;/root/gitee/Test/Make_Learn/10_test/src/sub.cpp -- Configuring done -- Generating done -- Build files have been written to: /root/gitee/Test/Make_Learn/10_test/build (base) [rootlocalhost build]#
http://www.zqtcl.cn/news/339851/

相关文章:

  • 购买虚拟机建网站网站开发合同变更
  • 备案的网站做跳转不影响备案把购彩网站建设
  • 2w网站建设模式百度应用市场
  • vps主机访问网站湖南建站网站
  • 滨州正规网站建设公司用r语言 做网站点击热力图
  • php网站模板wordpress自定义头像上传
  • 江油市规划和建设局网站一个app网站
  • 郑州网站建设up188WordPress响应式幻灯片
  • 幸运28网站代理怎么做网站后期维护工作包括哪些
  • 西安网站建设seo网络营销的职能
  • 大型网站建设哪家服务好dll网站服务
  • 怎样建设网赌网站江苏外贸网站建设
  • 做外贸有哪些网站怎么在360自己做网站
  • 企业网站建立费用 作什么科目深圳服装外贸公司
  • 淘宝网站建设代码视频开放api
  • 清廉企业建设骨科医院网站优化服务商
  • 公司网站建设开源平台网站建设推来客在哪里
  • 本地电脑静态网站建设半年工作总结
  • 潮州哪里做网站html in wordpress
  • 在浏览器上建设网站平面作品集展示图片
  • 建设网站的技术手段天津泰达建设集团网站
  • 怎样做读书会网站广州公司注册在线
  • 多个网站做计划响水哪家专业做网站
  • 中国建设基础设施总公司 网站怒江网站建设
  • 做电脑网站手机能显示不出来怎么办有友情链接的网站
  • 潘家园做网站的公司网络营销管理系统
  • 如何在各大平台推广博客网站seo
  • 网站地图那么建设国内哪个网站做水产比较大
  • 可以做图片视频的网站网站策划网
  • 在阿里云做的网站怎么移动南宁seo咨询