CMake: Use option() instead of set(CACHE)

This commit is contained in:
kestred 2013-12-12 10:24:39 -07:00
parent ca041ae6d5
commit 4fa31ee4d6
2 changed files with 24 additions and 19 deletions

View File

@ -60,9 +60,9 @@ function(config_package PKG_NAME)
endif()
if(CONFIG_DISABLE_EVERYTHING)
set(USE_${PKG_NAME} FALSE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF)
else()
set(USE_${PKG_NAME} TRUE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" ON)
endif()
@ -83,14 +83,14 @@ function(config_package PKG_NAME)
# If using Discovery, we want to silently disable missing packages
if(CONFIG_DISABLE_MISSING)
set(USE_${PKG_NAME} FALSE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF)
endif()
endif()
else()
# If using DISCOVERED <OR> NOTHING, we want to silently disable missing packages
if(CONFIG_DISABLE_MISSING OR CONFIG_DISABLE_EVERYTHING)
set(USE_${PKG_NAME} FALSE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
option(USE_${PKG_NAME} "If on, compile Panda3D with ${DISPLAY_NAME}" OFF)
else()
# Otherwise, output failure to find package

View File

@ -35,14 +35,14 @@ if(HAVE_EIGEN)
if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND)
unset(BUILD_EIGEN_VECTORIZATION)
elseif(CONFIG_DISABLE_EVERYTHING)
set(BUILD_EIGEN_VECTORIZATION OFF CACHE BOOL "If on, vectorization is enabled in build.")
option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." OFF)
endif()
if(NOT DEFINED BUILD_EIGEN_VECTORIZATION)
message(STATUS "+ (vectorization enabled in build)")
endif()
set(BUILD_EIGEN_VECTORIZATION ON CACHE BOOL "If on, vectorization is enabled in build.")
option(BUILD_EIGEN_VECTORIZATION "If on, vectorization is enabled in build." ON)
if(BUILD_EIGEN_VECTORIZATION)
set(LINMATH_ALIGN TRUE)
@ -61,9 +61,9 @@ if(HAVE_OPENSSL)
endif()
if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 4)
set(BUILD_OPENSSL_ERROR_REPORTS ON CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
option(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." ON)
else()
set(BUILD_OPENSSL_ERROR_REPORTS OFF CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
set(BUILD_OPENSSL_ERROR_REPORTS "If on, OpenSSL reports verbose error messages when they occur." OFF)
endif()
if(BUILD_OPENSSL_ERROR_REPORTS)
@ -249,10 +249,12 @@ endif()
#if(HAVE_ROCKET)
# # Check for rocket python bindings
# if(FOUND_ROCKET_PYTHON)
# set(USE_ROCKET_PYTHON TRUE CACHE BOOL "If true, compile Panda3D with python bindings for libRocket")
# option(USE_ROCKET_PYTHON "If on, compile Panda3D with python bindings for libRocket" ON)
# if(USE_ROCKET_PYTHON)
# set(HAVE_ROCKET_PYTHON TRUE)
# endif()
# else()
# unset(USE_ROCKET_PYTHON CACHE)
# endif()
# if(HAVE_ROCKET_PYTHON)
# message(STATUS "+ libRocket with Python bindings")
@ -273,10 +275,12 @@ endif()
### Configure interrogate ###
message(STATUS "") # simple line break
if(HAVE_PYTHON)
set(USE_INTERROGATE TRUE CACHE BOOL "If true, Panda3D will generate python interfaces")
option(USE_INTERROGATE "If on, Panda3D will generate python interfaces" ON)
if(USE_INTERROGATE)
set(HAVE_INTERROGATE TRUE)
endif()
else()
unset(USE_INTERROGATE CACHE)
endif()
if(HAVE_INTERROGATE)
message(STATUS "Compilation will generate Python interfaces.")
@ -287,7 +291,7 @@ endif()
### Configure threading support ###
# Add basic use flag for threading
set(USE_THREADS TRUE CACHE BOOL "If true, compile Panda3D with threading support.")
option(USE_THREADS "If on, compile Panda3D with threading support." ON)
if(USE_THREADS)
set(HAVE_THREADS TRUE)
else()
@ -297,9 +301,9 @@ endif()
# Configure debug threads
if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 3)
set(BUILD_DEBUG_THREADS ON CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" ON)
else()
set(BUILD_DEBUG_THREADS OFF CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" OFF)
endif()
if(BUILD_DEBUG_THREADS)
set(DEBUG_THREADS TRUE)
@ -307,10 +311,10 @@ endif()
# Add advanced threading configuration
if(HAVE_THREADS)
set(BUILD_SIMPLE_THREADS FALSE CACHE BOOL "If true, compile with simulated threads.")
option(BUILD_SIMPLE_THREADS "If on, compile with simulated threads." OFF)
if(BUILD_SIMPLE_THREADS)
message(STATUS "Compilation will include simulated threading support.")
set(BUILD_OS_SIMPLE_THREADS TRUE CACHE BOOL "If true, OS threading constructs will be used to perform context switches.")
option(BUILD_OS_SIMPLE_THREADS "If on, OS threading constructs will be used to perform context switches." ON)
set(SIMPLE_THREADS TRUE)
if(BUILD_OS_SIMPLE_THREADS)
@ -319,7 +323,7 @@ if(HAVE_THREADS)
else()
unset(BUILD_OS_SIMPLE_THREADS CACHE)
set(BUILD_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON)
if(BUILD_PIPELINING)
message(STATUS "Compilation will include full, pipelined threading support.")
else()
@ -353,9 +357,9 @@ endif()
### Configure pipelining ###
if(NOT DEFINED BUILD_PIPELINING)
if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 2)
set(BUILD_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON)
else()
set(BUILD_PIPELINING FALSE CACHE BOOL "If true, compile with pipelined rendering.")
option(BUILD_PIPELINING "If on, compile with pipelined rendering." OFF)
endif()
endif()
if(BUILD_PIPELINING)
@ -364,7 +368,7 @@ endif()
### Configure OS X options ###
if(OSX_PLATFORM)
set(BUILD_UNIVERSIAL_BINARIES TRUE CACHE BOOL "If true, compiling will create universal OS X binaries.")
option(BUILD_UNIVERSIAL_BINARIES "If on, compiling will create universal OS X binaries." ON)
if(BUILD_UNIVERSAL_BINARIES)
message(STATUS "Compilation will create universal binaries.")
set(UNIVERSAL_BINARIES TRUE)
@ -401,6 +405,7 @@ check_include_file_cxx(ucontext.h PHAVE_UCONTEXT_H)
check_include_file_cxx(linux/input.h PHAVE_LINUX_INPUT_H)
check_include_file_cxx(stdint.h PHAVE_STDINT_H)
# TODO: Actually check for these, instead of assuming
set(HAVE_NAMESPACE ON)
set(HAVE_LOCKF ON)
set(HAVE_WCHAR_T ON)