CMake的:如何在使用的CMakeLists.txt bash命令 [英] CMake : how to use bash command in CMakeLists.txt
本文介绍了CMake的:如何在使用的CMakeLists.txt bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我怎么能在使用的CMakeLists.txt bash命令。我想要的是得到使用检索处理器的数目:
I'm wondering how I can use bash command in CMakeLists.txt. What I want is to get the number of processor retrieved using :
export variable=`getconf _NPROCESSORS_ONLN`
和使用类似设置NB_PROCESSOR变量:
and set NB_PROCESSOR to variable using something like :
SET (NB_PROCESSOR variable)
所以我的问题是我怎么能在使用的CMakeLists.txt的getconf命令,我怎么可以使用的结果(保存在变量)的CMake的SET命令?
So my question is how can I use the getconf command in CMakeLists.txt and how can I use the result (stored in variable) in CMake SET command?
推荐答案
这似乎这样的伎俩,并保存套了。
This seems to do the trick, and saves the "set" too.
execute_process(COMMAND getconf _NPROCESSORS_ONLN
OUTPUT_VARIABLE NB_PROCESSOR)
这篇关于CMake的:如何在使用的CMakeLists.txt bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文