# HG changeset patch # User Tero Marttila # Date 1233005948 -7200 # Node ID 4ee797e09383ab23fa1c51b34950c2224deeed68 # Parent 82b0f4e55a133f2e9d1213cb74da00bbff6efbb4 convert CMakeLists to use CMake's OPTION command (with our own wrapper) diff -r 82b0f4e55a13 -r 4ee797e09383 src/CMakeLists.txt --- a/src/CMakeLists.txt Mon Jan 26 23:26:44 2009 +0200 +++ b/src/CMakeLists.txt Mon Jan 26 23:39:08 2009 +0200 @@ -3,30 +3,23 @@ set_source_files_properties("version.c" PROPERTIES GENERATED true) -# Component selection -if (DEFINED GRAPHICS_ENABLED) - # leave it - -elseif (DEFINED ENABLE_GRAPHICS) - set (GRAPHICS_ENABLED ${ENABLE_GRAPHICS}) - -else (DEFINED GRAPHICS_ENABLED) - set (GRAPHICS_ENABLED true) - -endif (DEFINED GRAPHICS_ENABLED) +# define + adapt option value, these need to be set as C++ booleans +macro (kg_option option_var option_config description default) + option (${option_var} ${description} ${default}) -if (DEFINED NETWORK_ENABLED) - # leave it - -elseif (DEFINED ENABLE_NETWORK) - set (NETWORK_ENABLED ${ENABLE_NETWORK}) + if (${option_var}) + set (${option_config} true) + else (${option_var}) + set (${option_config} false) + endif (${option_var}) -else (DEFINED NETWORK_ENABLED) - set (NETWORK_ENABLED true) + mark_as_advanced(${option_var}) +endmacro (kg_option) -endif (DEFINED NETWORK_ENABLED) - -mark_as_advanced (CLEAR GRAPHICS_ENABLED NETWORK_ENABLED) +# Define options +KG_OPTION (ENABLE_DEBUG DEBUG_ENABLED "Enable debug behaviour" ON) +KG_OPTION (ENABLE_GRAPHICS GRAPHICS_ENABLED "Enable graphics support" ON) +KG_OPTION (ENABLE_NETWORK NETWORK_ENABLED "Enable network support" ON) # Generate config.h configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) diff -r 82b0f4e55a13 -r 4ee797e09383 src/config.h.in --- a/src/config.h.in Mon Jan 26 23:26:44 2009 +0200 +++ b/src/config.h.in Mon Jan 26 23:39:08 2009 +0200 @@ -18,7 +18,7 @@ * * * Default log level is DEBUG instead of INFO */ -#define DEBUG_ENABLED false +#define DEBUG_ENABLED @DEBUG_ENABLED@ /** * Provide possibility to compile without graphics code.