Skip to content

build: remove unused FindIconv.cmake and ${ICONV_LIBRARIES} reference#1172

Merged
lotem merged 1 commit into
rime:masterfrom
black-desk:remove-findiconv
Jun 8, 2026
Merged

build: remove unused FindIconv.cmake and ${ICONV_LIBRARIES} reference#1172
lotem merged 1 commit into
rime:masterfrom
black-desk:remove-findiconv

Conversation

@black-desk

Copy link
Copy Markdown
Contributor

Pull request

Issue tracker

Unit test

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

Both the custom FindIconv.cmake module and the ${ICONV_LIBRARIES}
reference in src/CMakeLists.txt were added in 20cec49
("Link to iconv library.", 2016-02-11), alongside a find_package(Iconv)
call in the main CMakeLists.txt.

At that time:

  • charset_filter.cc used boost::locale::conv::from_utf() which
    depends on iconv through boost-locale.
  • librime requested the boost "locale" component via find_package.
  • Boost had no CMake config files (built with bjam/b2). CMake's
    FindBoost.cmake only located boost libraries themselves without
    handling transitive dependencies like iconv.
  • CMake did not yet provide a built-in FindIconv module (that was
    added in CMake 3.11, released in 2018), so a custom one was
    necessary.

The custom FindIconv.cmake set ICONV_FOUND (all caps) and
ICONV_LIBRARIES, which was fine since only librime consumed it.

In a2241d8 ("refactor(charset_filter): reduce to basic
implementation", 2019-12-25), charset_filter was simplified to a
basic extended-CJK filter using only the utf8 library. The
boost::locale usage and the boost "locale" component dependency
were both removed. The find_package(Iconv) call in the main
CMakeLists.txt was also deleted at some point.

However, FindIconv.cmake itself and the ${ICONV_LIBRARIES} reference
in src/CMakeLists.txt were left behind. Since the find_package(Iconv)
call no longer exists, FindIconv.cmake is never loaded and
${ICONV_LIBRARIES} is always empty.

Worse, the stale module now causes build failures in certain
environments: newer boost-locale CMake configs call
find_dependency(Iconv), and CMake picks up this old module from
CMAKE_MODULE_PATH. It sets ICONV_FOUND instead of the CMake-standard
Iconv_FOUND, causing a variable-name mismatch.

Both the custom FindIconv.cmake module and the ${ICONV_LIBRARIES}
reference in src/CMakeLists.txt were added in 20cec49
("Link to iconv library.", 2016-02-11), alongside a find_package(Iconv)
call in the main CMakeLists.txt.

At that time:
- charset_filter.cc used boost::locale::conv::from_utf() which
  depends on iconv through boost-locale.
- librime requested the boost "locale" component via find_package.
- Boost had no CMake config files (built with bjam/b2).  CMake's
  FindBoost.cmake only located boost libraries themselves without
  handling transitive dependencies like iconv.
- CMake did not yet provide a built-in FindIconv module (that was
  added in CMake 3.11, released in 2018), so a custom one was
  necessary.

The custom FindIconv.cmake set ICONV_FOUND (all caps) and
ICONV_LIBRARIES, which was fine since only librime consumed it.

In a2241d8 ("refactor(charset_filter): reduce to basic
implementation", 2019-12-25), charset_filter was simplified to a
basic extended-CJK filter using only the utf8 library.  The
boost::locale usage and the boost "locale" component dependency
were both removed.  The find_package(Iconv) call in the main
CMakeLists.txt was also deleted at some point.

However, FindIconv.cmake itself and the ${ICONV_LIBRARIES} reference
in src/CMakeLists.txt were left behind.  Since the find_package(Iconv)
call no longer exists, FindIconv.cmake is never loaded and
${ICONV_LIBRARIES} is always empty.

Worse, the stale module now causes build failures in certain
environments: newer boost-locale CMake configs call
find_dependency(Iconv), and CMake picks up this old module from
CMAKE_MODULE_PATH.  It sets ICONV_FOUND instead of the CMake-standard
Iconv_FOUND, causing a variable-name mismatch.

@lotem lotem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@lotem lotem merged commit 1d42b00 into rime:master Jun 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants