svn commit: r1919837 - in /subversion/branches/cmake: CMakeLists.txt build/cmake/FindUTF8PROC.cmake

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Mon Aug 12 21:48:23 2024
New Revision: 1919837

URL: http://svn.apache.org/viewvc?rev=1919837&view=rev
Log:
On the 'cmake' branch: Support using UTF8Proc as external library.

* build/cmake/FindUTF8PROC.cmake:
  New CMake module for the UTF8Proc library.

* CMakeLists.txt
  (UTF8Proc): Remove TODO comment and use the UTF8PROC module for the
   dependency.

Added:
    subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake   (with props)
Modified:
    subversion/branches/cmake/CMakeLists.txt

Modified: subversion/branches/cmake/CMakeLists.txt
URL: http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919837&r1=1919836&r2=1919837&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Mon Aug 12 21:48:23 2024
@@ -221,9 +221,8 @@ if(SVN_USE_INTERNAL_UTF8PROC)
     UTF8PROC_VERSION_MAJOR UTF8PROC_VERSION_MINOR UTF8PROC_VERSION_PATCH
   )
 else()
-  message(FATAL_ERROR "TODO:")
-  # find_package(utf8proc CONFIG REQUIRED)
-  # add_library(external-utf8proc ALIAS utf8proc)
+  find_package(utf8proc REQUIRED)
+  add_library(external-utf8proc ALIAS UTF8PROC::UTF8PROC)
 endif()
 
 ### SQLite3

Added: subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake
URL: http://svn.apache.org/viewvc/subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake?rev=1919837&view=auto
==============================================================================
--- subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake (added)
+++ subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake Mon Aug 12 21:48:23 2024
@@ -0,0 +1,67 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# FindUTF8PROC.cmake -- Find the UTF-8 processing library
+#
+
+find_path(UTF8PROC_INCLUDE_DIR
+  NAMES UTF8PROC.h
+  PATH_SUFFIXES
+    include
+)
+
+find_library(UTF8PROC_LIBRARY
+  NAMES UTF8PROC
+  PATH_SUFFIXES lib
+)
+
+mark_as_advanced(
+  UTF8PROC_INCLUDE_DIR
+  UTF8PROC_LIBRARY
+)
+
+if(UTF8PROC_INCLUDE_DIR AND EXISTS ${UTF8PROC_INCLUDE_DIR}/UTF8PROC.h)
+  file(
+    STRINGS "${UTF8PROC_INCLUDE_DIR}/UTF8PROC.h" VERSION_STRINGS
+    REGEX "#define (UTF8PROC_VERSION_MAJOR|UTF8PROC_VERSION_MINOR|UTF8PROC_VERSION_PATCH)"
+  )
+
+  string(REGEX REPLACE ".*UTF8PROC_VERSION_MAJOR +([0-9]+).*" "\\1" UTF8PROC_VERSION_MAJOR ${VERSION_STRINGS})
+  string(REGEX REPLACE ".*UTF8PROC_VERSION_MINOR +([0-9]+).*" "\\1" UTF8PROC_VERSION_MINOR ${VERSION_STRINGS})
+  string(REGEX REPLACE ".*UTF8PROC_VERSION_PATCH +([0-9]+).*" "\\1" UTF8PROC_VERSION_PATCH ${VERSION_STRINGS})
+
+  set(UTF8PROC_VERSION "${UTF8PROC_VERSION_MAJOR}.${UTF8PROC_VERSION_MINOR}.${UTF8PROC_VERSION_PATCH}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+  UTF8PROC
+  REQUIRED_VARS
+    UTF8PROC_LIBRARY
+    UTF8PROC_INCLUDE_DIR
+  VERSION_VAR
+    UTF8PROC_VERSION
+)
+
+if(UTF8PROC_FOUND)
+  add_library(UTF8PROC::UTF8PROC IMPORTED STATIC)
+  set_target_properties(UTF8PROC::UTF8PROC PROPERTIES
+    IMPORTED_LOCATION ${UTF8PROC_LIBRARY}
+    INTERFACE_INCLUDE_DIRECTORIES ${UTF8PROC_INCLUDE_DIR}
+  )
+endif()

Propchange: subversion/branches/cmake/build/cmake/FindUTF8PROC.cmake
------------------------------------------------------------------------------
    svn:eol-style = native
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.