On 2026/05/07 20:59, Jun Omae wrote:
> On 2026/05/05 0:09, [email protected] wrote:
>> Author: rinrab
>> Date: Mon May 4 15:09:48 2026
>> New Revision: 1933812
>>
>> Log:
>> cmake: Import targets.cmake before processing dependencies; This would allow
>> potentially refering to those targets in dependency search. Although cmake
>> allows to link a non-existing target, the target that it is linked to has to
>> be
>> declared before.
>>
>> * CMakeLists.txt
>> (target_exports, ra-libs, fs-libs, the-include): Move them up.
>>
>> Modified:
>> subversion/trunk/CMakeLists.txt
> Encountered another issue with SVN_ENABLE_NLS=ON on macOS and Windows....
>
> [[[
> FAILED: [code=1] libsvn_delta-1.0.16.0.dylib
> : && /usr/bin/cc -dynamiclib -Wl,-headerpad_max_install_names
> -current_version 0.16.0 -o libsvn_delta-1.0.16.0.dylib ...
> Undefined symbols for architecture x86_64:
> "_libintl_dgettext", referenced from:
> _write_handler in svndiff.c.o
> _write_handler in svndiff.c.o
> _write_handler in svndiff.c.o
> _close_handler in svndiff.c.o
> _svn_txdelta_read_svndiff_window in svndiff.c.o
> _read_window_header in svndiff.c.o
> _read_window_header in svndiff.c.o
> _read_window_header in svndiff.c.o
> _read_window_header in svndiff.c.o
> _read_window_header in svndiff.c.o
> _read_window_header in svndiff.c.o
> ...
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> ]]]
>
> [[[
> V:\usr\src\subversion\subversion.git\Release\cmake\svn_private_config.h(126,11):
> error C1083: Cannot open include file: 'libintl.h':
> No such file or directory
> [V:\usr\src\subversion\subversion.git\Release\cmake\libsvn_fs_util.vcxproj]
> (compiling source file '../../subversion/libsvn_fs_util/fs-util.c')
> ]]]
Proposed patch, cmake-nls-r1933902.patch.txt, attached.
* Find gettext and intl packages before include(../targets.cmake).
* Use include_directories("${Intl_INCLUDE_DIRS}") rather than
set_target_properties(Intl::Intl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${Intl_INCLUDE_DIRS}" ...)
because svn_private_config.h globally includes <libintl.h>.
I confirmed that the builds successfully on Ubuntu, macOS and Windows.
--
Jun Omae <[email protected]> (大前 潤)commit b79cf900a3e960bb11942d8140126bf8a100c8e8
Author: Jun Omae <[email protected]>
Date: Fri May 8 11:01:07 2026 +0900
cmake: find gettext and intl packages before the targets.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3830d11515..30873da228 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -297,6 +297,78 @@ if (NOT EXISTS
"${CMAKE_SOURCE_DIR}/build/cmake/targets.cmake")
)
endif()
+if(SVN_ENABLE_NLS)
+ # Note: when installing these dependecies with vcpkg, you will need to
+ # install 'gettext' package with 'tools' feature. Use the following command
+ # for this: `./vcpkg install gettext[tools]`. This package contains both,
+ # Gettext and Intl dependecies.
+ find_package(Gettext REQUIRED)
+ find_package(Intl REQUIRED)
+
+ # If using CMake of version < 3.20, FindIntl would not define IMPORTED
target.
+ # https://cmake.org/cmake/help/latest/module/FindIntl.html
+ if(NOT TARGET Intl::Intl)
+ add_library(Intl::Intl INTERFACE IMPORTED)
+ include_directories("${Intl_INCLUDE_DIRS}")
+ set_target_properties(Intl::Intl PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}"
+ )
+ endif()
+
+ add_library(external-intl ALIAS Intl::Intl)
+
+ add_private_config_definition(
+ "Define to 1 if translation of program messages to the user's native
language is requested."
+ "ENABLE_NLS" "1"
+ )
+
+ if (NOT WIN32)
+ add_private_config_definition(
+ "Defined to be the path to the installed locale dirs"
+ "SVN_LOCALE_DIR" "\"${CMAKE_INSTALL_PREFIX}/share/locale\""
+ )
+ endif()
+
+ add_custom_target(locale ALL)
+
+ file(GLOB SVN_PO_FILES "subversion/po/*.po")
+
+ foreach(po_file ${SVN_PO_FILES})
+ get_filename_component(lang ${po_file} NAME_WLE)
+ set(mo_file "${CMAKE_BINARY_DIR}/${lang}.mo")
+
+ add_custom_command(
+ DEPENDS
+ "${po_file}"
+ OUTPUT
+ "${mo_file}"
+ COMMAND
+ "${GETTEXT_MSGFMT_EXECUTABLE}" -c -o ${mo_file} ${po_file}
+ )
+
+ target_sources(locale PRIVATE ${mo_file})
+
+ install(
+ FILES "${mo_file}"
+ DESTINATION "share/locale/${lang}/LC_MESSAGES"
+ RENAME "subversion.mo"
+ )
+ endforeach()
+else()
+ # Declare empty target for Intl if we don't use it.
+ add_library(external-intl INTERFACE)
+endif()
+
+# Link all targets with Intl library. The 'external-intl' target is always,
+# even if we don't use NLS functionality.
+#
+# Following the CMake documentation [1], the link_libraries affects only on
+# the targets declared later, so it should be here.
+#
+# [1] https://cmake.org/cmake/help/latest/command/link_libraries.html
+# -- "Link libraries to all targets added later."
+link_libraries(external-intl)
+
add_library(ra-libs INTERFACE)
add_library(fs-libs INTERFACE)
@@ -789,78 +861,6 @@ if (MSVC)
)
endif()
-if(SVN_ENABLE_NLS)
- # Note: when installing these dependecies with vcpkg, you will need to
- # install 'gettext' package with 'tools' feature. Use the following command
- # for this: `./vcpkg install gettext[tools]`. This package contains both,
- # Gettext and Intl dependecies.
- find_package(Gettext REQUIRED)
- find_package(Intl REQUIRED)
-
- # If using CMake of version < 3.20, FindIntl would not define IMPORTED
target.
- # https://cmake.org/cmake/help/latest/module/FindIntl.html
- if(NOT TARGET Intl::Intl)
- add_library(Intl::Intl INTERFACE IMPORTED)
- set_target_properties(Intl::Intl PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${Intl_INCLUDE_DIRS}"
- INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}"
- )
- endif()
-
- add_library(external-intl ALIAS Intl::Intl)
-
- add_private_config_definition(
- "Define to 1 if translation of program messages to the user's native
language is requested."
- "ENABLE_NLS" "1"
- )
-
- if (NOT WIN32)
- add_private_config_definition(
- "Defined to be the path to the installed locale dirs"
- "SVN_LOCALE_DIR" "\"${CMAKE_INSTALL_PREFIX}/share/locale\""
- )
- endif()
-
- add_custom_target(locale ALL)
-
- file(GLOB SVN_PO_FILES "subversion/po/*.po")
-
- foreach(po_file ${SVN_PO_FILES})
- get_filename_component(lang ${po_file} NAME_WLE)
- set(mo_file "${CMAKE_BINARY_DIR}/${lang}.mo")
-
- add_custom_command(
- DEPENDS
- "${po_file}"
- OUTPUT
- "${mo_file}"
- COMMAND
- "${GETTEXT_MSGFMT_EXECUTABLE}" -c -o ${mo_file} ${po_file}
- )
-
- target_sources(locale PRIVATE ${mo_file})
-
- install(
- FILES "${mo_file}"
- DESTINATION "share/locale/${lang}/LC_MESSAGES"
- RENAME "subversion.mo"
- )
- endforeach()
-else()
- # Declare empty target for Intl if we don't use it.
- add_library(external-intl INTERFACE)
-endif()
-
-# Link all targets with Intl library. The 'external-intl' target is always,
-# even if we don't use NLS functionality.
-#
-# Following the CMake documentation [1], the link_libraries affects only on
-# the targets declared later, so it should be here.
-#
-# [1] https://cmake.org/cmake/help/latest/command/link_libraries.html
-# -- "Link libraries to all targets added later."
-link_libraries(external-intl)
-
# Build shared libraries and theirs implibs with 'lib' prefix, for example
# libsvn_subr-1.[lib|a] and libsvn_subr-1.[dll|so]
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")