build: remove unused FindIconv.cmake and ${ICONV_LIBRARIES} reference#1172
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Issue tracker
Unit test
Manual test
Code Review
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:
depends on iconv through boost-locale.
FindBoost.cmake only located boost libraries themselves without
handling transitive dependencies like iconv.
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.