[CMake] Passing -j (or other make flags) to make?

Martin Apel martin.apel at simpack.de
Thu Dec 18 02:44:15 EST 2008


Tyler Roscoe wrote:
> Is there a way to set flags for make from my CMakeLists.txt?
>
> Specifically, I have a cluster of build machines and I would like each
> of them to use a specific -j flag. (I would set the -j flag in a
> "global" cmake file where I set up things like project-wide -D flags and
> third-party library locations.)
>
> -j is a make option, not a compiler option, so I can't use
> ADD_DEFINITIONS or CMAKE_CXX_FLAGS.
>
> I couldn't find anything with google. This old thread talks about
> $(MAKEFLAGS) but setting that variable doesn't seem to help me:
>
> http://www.cmake.org/pipermail/cmake/2003-October/004398.html
>
> Is this possible? Or do I need to make a wrapper script to set up extra
> options for make?
>   
This is something not related to cmake. However you can set the
environment variable MAKEFLAGS in your .cshrc or whatever init file you
have for your shell.
You can do this depending on the system and get the behaviour you need.
I have been doing this since I have a quad core machine at work :-)

Regards,

Martin

____________
Virus checked by G DATA AntiVirus
Version: AVF 19.191 from 17.12.2008




More information about the CMake mailing list