PDA

View Full Version : Automate cmake options


provocating
09-10-2013, 12:52 PM
I am trying to script every bit of my server install, I will post it when I am done in case it could be of some use to someone. One part I am stuck on is automating the cmake options.

I am using variables so this is what I have, is there any way to pass the answers to cmake?

cmake -G "Unix Makefiles" -i $INSTALL_PATH/src/server/

demonstar55
09-10-2013, 01:40 PM
For example to build with all defaults but LUA on

cmake -G "Unix Makefiles" $INSTALL_PATH/src/server/ -DEQEMU_BUILD_LUA=ON

(Note: 0, 1, TRUE, FALSE, ON, and OFF will work here)

From the cmake manpage

-D <var>:<type>=<value>
Create a cmake cache entry.

When cmake is first run in an empty build tree, it creates a CMakeCache.txt file and populates it with
customizable settings for the project. This option may be used to specify a setting that takes prior‐
ity over the project's default value. The option may be repeated for as many cache entries as
desired.

edit:

OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
OPTION(EQEMU_BUILD_AZONE "Build azone utility." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
OPTION(EQEMU_BUILD_LUA "Build Lua parser." OFF)
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)

And a list that isn't copied out of the cmake file without explantions :P
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=/usr/local
EQEMU_BUILD_AZONE:BOOL=OFF
EQEMU_BUILD_LOGIN:BOOL=OFF
EQEMU_BUILD_LUA:BOOL=OFF
EQEMU_BUILD_PERL:BOOL=ON
EQEMU_BUILD_SERVER:BOOL=ON
EQEMU_BUILD_TESTS:BOOL=OFF
EQEMU_DEBUG_LEVEL:STRING=5
EQEMU_ENABLE_BOTS:BOOL=OFF

provocating
09-10-2013, 02:22 PM
Yes, this is very helpful. Thank you so much.