From 9ef66151afb118c6bcb1441badc2ee001be2f73f Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Mon, 2 Oct 2017 10:42:25 -0400 Subject: [PATCH] Ensure that runtime config files are available (non-default) for non-Unix. --- CMakeLists.txt | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c7e957..47ae443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,40 +159,49 @@ endif () #============================================================================= -# Unix console application features +# Runtime Configuration File Support # By default on Unix-like systems when building for the console program, # support runtime configuration files in /etc/ and in ~/. To prevent this, # set ENABLE_CONFIG_FILES to NO. Specify -DTIDY_CONFIG_FILE and/or # -DTIDY_USER_CONFIG_FILE to override the default paths in tidyplatform.h. # @note: this section refactored to support #584. #============================================================================= -if (UNIX AND SUPPORT_CONSOLE_APP) +if ( UNIX AND SUPPORT_CONSOLE_APP ) option ( ENABLE_CONFIG_FILES "Set to OFF to disable Tidy runtime configuration file support" ON ) - if ( ENABLE_CONFIG_FILES ) + # All Unixes support getpwnam(); undef'd in tidyplatform.h if necessary. + add_definitions( -DSUPPORT_GETPWNAM=1 ) + +else () + + option ( ENABLE_CONFIG_FILES "Set to ON to enable Tidy runtime configuration file support" OFF ) + if ( SUPPORT_GETPWNAM ) + add_definitions( -DSUPPORT_GETPWNAM=1 ) + endif () + +endif () + +if ( ENABLE_CONFIG_FILES ) + message(STATUS "*** Building support for runtime configuration files.") add_definitions( -DTIDY_ENABLE_CONFIG_FILES ) # For example, /etc/tidy.conf - if (TIDY_CONFIG_FILE) + if ( TIDY_CONFIG_FILE ) add_definitions( -DTIDY_CONFIG_FILE="${TIDY_CONFIG_FILE}" ) endif () - + # For example, ~/.tidy.rc - if (TIDY_USER_CONFIG_FILE) + if ( TIDY_USER_CONFIG_FILE ) add_definitions( -DTIDY_USER_CONFIG_FILE="${TIDY_USER_CONFIG_FILE}" ) endif () - - # All Unixes support getpwnam(); undef'd in tidyplatform.h if necessary. - add_definitions( -DSUPPORT_GETPWNAM=1 ) - endif () + endif () - - + if(BUILD_SHARED_LIB) set(LIB_TYPE SHARED)