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`
and set NB_PROCESSOR to variable using something like :
SET (NB_PROCESSOR variable)
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With