Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting cmake-gui options

I have a library with a bunch of different configuration options. We usually configure the build with cmake-gui and ticking a few checkboxes.

I want to automate this into a .sh script using just cmake.

e.g.
In GUI -> selects a bunch of different options
equivalent cmake command -> cmake -D CMAKE_XXX=X -D CMAKE_XXY=XXY [a bunch of options here] ..

How can I find the "equivalent" cmake command-line command to any arbitrary configuration I choose from the GUI?

like image 317
ButterDog Avatar asked Mar 17 '23 00:03

ButterDog


1 Answers

The equivalent cmake command to cache a variable is explained here (-D option). Note that previous documentation was ambiguous, so take care of always checking the latest one.

Basically:

-D<var>:<type>=<value>

You have to specify also the type to have the variable cached in the same way as through your cmake-gui procedure. Note that variable definition is necessary only the first time: if not specified anymore, the cached value will be used.

like image 180
Antonio Avatar answered Mar 18 '23 14:03

Antonio