Use option() CMake command

This is the appropriate command for ON/OFF options controlled by the
user. Also removed the useless C99 option which must always be on (using
C11 would be another option).
This commit is contained in:
Markus Mäkelä 2018-08-19 06:24:12 +03:00
parent 0685276764
commit 67df3ad4f0
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 22 additions and 65 deletions

View File

@ -146,13 +146,6 @@ if(PROFILE)
set(FLAGS "${FLAGS} -pg " CACHE STRING "Compilation flags" FORCE)
endif()
if(USE_C99)
message(STATUS "Using C99 standard")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_GNU_SOURCE=1 ${FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
endif()
if (WITH_ASAN AND ASAN_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
@ -161,6 +154,7 @@ elseif (WITH_TSAN AND TSAN_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_GNU_SOURCE=1 ${FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS} -DSS_DEBUG -DLOG_ASSERT")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-uninitialized")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -Wno-uninitialized")

View File

@ -3,62 +3,25 @@
# You can change these through CMake by adding -D<variable>=<value> when
# configuring the build.
# Use C99
set(USE_C99 TRUE CACHE BOOL "Use C99 standard")
# Default user for the administrative interface
set(DEFAULT_ADMIN_USER "root" CACHE STRING "Default user for the administrative interface")
# Install the template maxscale.cnf file
set(WITH_MAXSCALE_CNF TRUE CACHE BOOL "Install the template maxscale.cnf file")
# Use static version of libmysqld
set(STATIC_EMBEDDED TRUE CACHE BOOL "Use static version of libmysqld")
# Build RabbitMQ components
set(BUILD_RABBITMQ TRUE CACHE BOOL "Build RabbitMQ components")
# Build the binlog router
set(BUILD_BINLOG TRUE CACHE BOOL "Build binlog router")
# Build the Avro router
set(BUILD_CDC TRUE CACHE BOOL "Build Avro router")
# Build the multimaster monitor
set(BUILD_MMMON TRUE CACHE BOOL "Build multimaster monitor")
# Build MaxCtrl
set(BUILD_MAXCTRL TRUE CACHE BOOL "Build MaxCtrl")
# Build Luafilter
set(BUILD_LUAFILTER TRUE CACHE BOOL "Build Luafilter")
# Use gcov build flags
set(GCOV FALSE CACHE BOOL "Use gcov build flags")
# Install init.d scripts and ldconf configuration files
set(WITH_SCRIPTS TRUE CACHE BOOL "Install init.d scripts and ldconf configuration files")
# Build tests
set(BUILD_TESTS TRUE CACHE BOOL "Build tests")
# Build packages
set(PACKAGE FALSE CACHE BOOL "Enable package building (this disables local installation of system files)")
# Build extra tools
set(BUILD_TOOLS FALSE CACHE BOOL "Build extra utility tools")
# Profiling
set(PROFILE FALSE CACHE BOOL "Profiling (gprof)")
# Use tcmalloc as the memory allocator
set(WITH_TCMALLOC FALSE CACHE BOOL "Use tcmalloc as the memory allocator")
# Use jemalloc as the memory allocator
set(WITH_JEMALLOC FALSE CACHE BOOL "Use jemalloc as the memory allocator")
# Install experimental modules
set(INSTALL_EXPERIMENTAL TRUE CACHE BOOL "Install experimental modules")
option(WITH_MAXSCALE_CNF "Install the template maxscale.cnf file" ON)
option(STATIC_EMBEDDED "Use static version of libmysqld" ON)
option(BUILD_RABBITMQ "Build RabbitMQ components" ON)
option(BUILD_BINLOG "Build binlog router" ON)
option(BUILD_CDC "Build Avro router" ON)
option(BUILD_MMMON "Build multimaster monitor" ON)
option(BUILD_MAXCTRL "Build MaxCtrl" ON)
option(BUILD_LUAFILTER "Build Luafilter" ON)
option(GCOV "Use gcov build flags" OFF)
option(WITH_SCRIPTS "Install init.d scripts and ldconf configuration files" ON)
option(BUILD_TESTS "Build tests" ON)
option(PACKAGE "Enable package building (this disables local installation of system files)" OFF)
option(BUILD_TOOLS "Build extra utility tools" OFF)
option(PROFILE "Profiling (gprof)" OFF)
option(WITH_TCMALLOC "Use tcmalloc as the memory allocator" OFF)
option(WITH_JEMALLOC "Use jemalloc as the memory allocator" OFF)
option(INSTALL_EXPERIMENTAL "Install experimental modules" OK)
option(WITH_ASAN "Enable AddressSanitizer" OFF)
option(WITH_ASAN "Enable ThreadSanitizer" OFF)
# Default package name
set(PACKAGE_NAME "maxscale" CACHE STRING "Name of the generated package")
@ -66,5 +29,5 @@ set(PACKAGE_NAME "maxscale" CACHE STRING "Name of the generated package")
# Which component to build (core, experimental, devel, cdc-connector, all)
set(TARGET_COMPONENT "core" CACHE STRING "Which component to build (core, experimental, devel, cdc-connector, all)")
# Enable AddressSanitizer: https://github.com/google/sanitizers/wiki/AddressSanitizer
set(WITH_ASAN FALSE CACHE BOOL "Enable AddressSanitizer")
# Default user for the administrative interface
set(DEFAULT_ADMIN_USER "root" CACHE STRING "Default user for the administrative interface")