Ensure that runtime config files are available (non-default) for non-Unix.

This commit is contained in:
Jim Derry 2017-10-02 10:42:25 -04:00
parent 9c6a1e47ae
commit 9ef66151af
1 changed files with 21 additions and 12 deletions

View File

@ -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)