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

CMake 判断操作系统类型

上回的CMakeLists.txt里面有一句,if (WIN32)......endif(WIN32);

根据资料,这是判断操作系统是否是Windows;

下面单独看一下;

一个CMakeLists.txt文件如下;

if(WIN32)
    # 如果是 Windows
    message("当前操作系统为 Windows")
elseif(UNIX AND NOT APPLE)
    # 如果是 Linux
    message("当前操作系统为 Linux")
else()
    message(FATAL_ERROR "不支持的操作系统类型")
endif()

然后运行看一下,如下图;

 

它有一些输出;

CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as

project(ProjectName)

near the top of the file, but after cmake_minimum_required().

CMake is pretending there is a "project(Proj


http://www.kler.cn/news/137288.html

相关文章:

  • git基本操作(配图超详细讲解)
  • 交叉编译tcpdump
  • 游戏中的资源动态加载
  • 重磅解读 | 阿里云 云网络领域关键技术创新
  • 入行IC | 从小白助理级,到总监专家级,到底要经历怎样的成长阶段呢?
  • go map字典操作
  • 卷积神经网络(VGG-19)灵笼人物识别
  • Python每日一练-DAY01
  • docker通过挂载conf文件启动redis
  • LeetCode39- 组合总和
  • 掌握深度学习利器——TensorFlow 2.x实战应用与进阶
  • scp rsync 软连接
  • linux控制台命令
  • OpenCV 中Mat.depth()的理解——每个像素的位数——每个像素中每个通道的精度
  • Qt中的tr函数
  • Java 基础面试题大概有哪些?
  • spring为什么要使用三级缓存来解决循环依赖
  • Java语言的特点||运算符
  • stack和queue简单实现(容器适配器)
  • mysql8 修改用户密码