CMAKE_SYSTEM_NAME是空白吗? [英] CMAKE_SYSTEM_NAME blank?

查看:140
本文介绍了CMAKE_SYSTEM_NAME是空白吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译Linux(使用Generator Eclipse CDT4 - Ninja ),但是当我检查 $ {CMAKE_SYSTEM_NAME}

I am trying to compile for Linux (with Generator Eclipse CDT4 - Ninja) but when I am checking for ${CMAKE_SYSTEM_NAME} in CMakeLists.txt, all I get is blank.

在哪些情况下使用此变量有效?

In which scenarios is using this variable valid?

使用Debian测试中的cmake 3.02。

Using cmake 3.02 from Debian Testing.

推荐答案

=http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_SYSTEM_NAME.html> CMAKE_SYSTEM_NAME project 命令:

You need to place CMAKE_SYSTEM_NAME after project command:

message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
project(Foo)
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")

结果:

CMAKE_SYSTEM_NAME: 
-- The C compiler identification is GNU 4.9.1
...
-- Detecting CXX compiler ABI info - done
CMAKE_SYSTEM_NAME: Linux

这篇关于CMAKE_SYSTEM_NAME是空白吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆