Author: rinrab
Date: Thu Oct 17 11:14:52 2024
New Revision: 1921379
URL: http://svn.apache.org/viewvc?rev=1921379&view=rev
Log:
cmake: Factor-out add_private_config_definition macro for adding definitions
to the private config.
In the past, we had to append and format a string to the
PRIVATE_CONFIG_DEFINITIONS variable manually in order to create new
definitions in svn_private_config.h header. This commit introduces
a new function add_private_config_definition() for this, which will
build the string and append it to the file.
* CMakeLists.txt
(add_private_config_definition): New macro.
(): Use the add_private_config_definition function everywhere.
Modified:
subversion/trunk/CMakeLists.txt
Modified: subversion/trunk/CMakeLists.txt
URL:
http://svn.apache.org/viewvc/subversion/trunk/CMakeLists.txt?rev=1921379&r1=1921378&r2=1921379&view=diff
==============================================================================
--- subversion/trunk/CMakeLists.txt (original)
+++ subversion/trunk/CMakeLists.txt Thu Oct 17 11:14:52 2024
@@ -120,6 +120,23 @@ endif()
set(PRIVATE_CONFIG_DEFINITIONS "")
+macro(add_private_config_definition comment name value)
+ string(APPEND PRIVATE_CONFIG_DEFINITIONS
+ "\n"
+ "/* ${comment} */\n"
+ )
+
+ if("${value}" STREQUAL "")
+ string(APPEND PRIVATE_CONFIG_DEFINITIONS
+ "#define ${name}\n"
+ )
+ else()
+ string(APPEND PRIVATE_CONFIG_DEFINITIONS
+ "#define ${name} ${value}\n"
+ )
+ endif()
+endmacro()
+
if (SVN_ENABLE_RA_LOCAL)
add_compile_definitions("SVN_LIBSVN_RA_LINKS_RA_LOCAL")
endif()
@@ -160,10 +177,9 @@ if(SVN_USE_DSO)
add_compile_definitions("SVN_USE_DSO")
endif()
-string(APPEND PRIVATE_CONFIG_DEFINITIONS
- "\n"
- "/* Shared library file name suffix format */\n"
- "#define SVN_DSO_SUFFIX_FMT \"%d${CMAKE_SHARED_LIBRARY_SUFFIX}\"\n"
+add_private_config_definition(
+ "Shared library file name suffix format"
+ "SVN_DSO_SUFFIX_FMT" "\"%d${CMAKE_SHARED_LIBRARY_SUFFIX}\""
)
add_compile_definitions("SVN_SOVERSION=${SVN_SOVERSION}")
@@ -521,10 +537,10 @@ macro(autocheck_include_files INCLUDE VA
check_include_files(${INCLUDE} ${VARIABLE})
if(${VARIABLE})
- string(APPEND PRIVATE_CONFIG_DEFINITIONS "\n")
- string(APPEND PRIVATE_CONFIG_DEFINITIONS
- "/* Define to 1 if you have the <${INCLUDE}> header file. */\n")
- string(APPEND PRIVATE_CONFIG_DEFINITIONS "#define ${VARIABLE} 1\n")
+ add_private_config_definition(
+ "Define to 1 if you have the <${INCLUDE}> header file."
+ "${VARIABLE}" "1"
+ )
endif()
endmacro()
@@ -532,10 +548,10 @@ macro(autocheck_symbol_exists SYMBOL FIL
check_symbol_exists(${SYMBOL} ${FILE} ${VARIABLE})
if(${VARIABLE})
- string(APPEND PRIVATE_CONFIG_DEFINITIONS "\n")
- string(APPEND PRIVATE_CONFIG_DEFINITIONS
- "/* Define to 1 if you have the `${SYMBOL}' function. */\n")
- string(APPEND PRIVATE_CONFIG_DEFINITIONS "#define ${VARIABLE} 1\n")
+ add_private_config_definition(
+ "Define to 1 if you have the `${SYMBOL}' function."
+ "${VARIABLE}" "1"
+ )
endif()
endmacro()