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?
Use the EXEC_PROGRAM command and then use the CACHE option of the SET command to save the output to a variable like GTK_PKG_FLAGS. Then use the SET command to add the value. Something like this:
Links: http://www.cmake.org/pipermail/cmake/2005-January/006051.html
This seems to do the trick, and saves the "set" too.