Author: rinrab
Date: Sun Jul 21 14:13:55 2024
New Revision: 1919443

URL: http://svn.apache.org/viewvc?rev=1919443&view=rev
Log:
On the 'cmake' branch: Use private config for check results.

Write the result of the checks to the svn_private_config.h, to make it
more similar to autoconf, which use this file for that. Also it makes it
easier debug and possibly adjust the checks. To add the definitions correctly,
add a variable for them. Afterwards, when we should add a definition to
the file, we will append few strings with comment, definition, and newline
to the variable. At the end of configure this variable will be configured
into the private config. 

* CMakeLists.txt
  (PRIVATE_CONFIG_DEFINITIONS): Declare to empty string.
  (autocheck_include_files,
   autocheck_symbol_exists): Write the result into PRIVATE_CONFIG_DEFINITIONS
   instead of using add_compile_definitions() command. 
  (private config): Move it down for the PRIVATE_CONFIG_DEFINITIONS variable
   to be prepared for the configure.

* subversion/svn_private_config.hc
  (PRIVATE_CONFIG_DEFINITIONS): Insert it into the file; don't leave any
   newlines to make it prettier, because PRIVATE_CONFIG_DEFINITIONS already
   contains them.

Modified:
    subversion/branches/cmake/CMakeLists.txt
    subversion/branches/cmake/subversion/svn_private_config.hc

Modified: subversion/branches/cmake/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919443&r1=1919442&r2=1919443&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Sun Jul 21 14:13:55 2024
@@ -93,8 +93,7 @@ if (SVN_BUILD_SVNXX)
   enable_language(CXX)
 endif()
 
-string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM_NAME}" 
SVN_BUILD_HOST)
-string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}" 
SVN_BUILD_TARGET)
+set(PRIVATE_CONFIG_DEFINITIONS "")
 
 configure_file(
   "${CMAKE_CURRENT_SOURCE_DIR}/subversion/svn_private_config.hc"
@@ -263,15 +262,23 @@ include(CheckSymbolExists)
 
 macro(autocheck_include_files INCLUDE VARIABLE)
   check_include_files(${INCLUDE} ${VARIABLE})
+
   if(${VARIABLE})
-    add_compile_definitions("${VARIABLE}=1")
+    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")
   endif()
 endmacro()
 
 macro(autocheck_symbol_exists SYMBOL FILE VARIABLE)
   check_symbol_exists(${SYMBOL} ${FILE} ${VARIABLE})
+
   if(${VARIABLE})
-    add_compile_definitions("${VARIABLE}=1")
+    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")
   endif()
 endmacro()
 
@@ -449,6 +456,14 @@ if (SVN_BUILD_SVNXX)
   )
 endif()
 
+string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM_NAME}" 
SVN_BUILD_HOST)
+string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}" 
SVN_BUILD_TARGET)
+
+configure_file(
+  "${CMAKE_CURRENT_SOURCE_DIR}/subversion/svn_private_config.hc"
+  "${CMAKE_CURRENT_BINARY_DIR}/svn_private_config.h"
+)
+
 message(STATUS "Configuration summary:")
 message(STATUS "  Version ......................... : ${SVN_VERSION}")
 message(STATUS "  Build type ...................... : ${CMAKE_BUILD_TYPE}")

Modified: subversion/branches/cmake/subversion/svn_private_config.hc
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/subversion/svn_private_config.hc?rev=1919443&r1=1919442&r2=1919443&view=diff
==============================================================================
--- subversion/branches/cmake/subversion/svn_private_config.hc (original)
+++ subversion/branches/cmake/subversion/svn_private_config.hc Sun Jul 21 
14:13:55 2024
@@ -51,7 +51,7 @@
 #else
 # define SVN_NULL_DEVICE_NAME "/dev/null"
 #endif
-
+@PRIVATE_CONFIG_DEFINITIONS@
 /* Defined to be the path to the installed binaries */
 #define SVN_BINDIR "/usr/local/bin"
 


Reply via email to