Giter Club home page Giter Club logo

libiconv_cmake's Issues

Avoid CMake Deprecation Warning

Hi @AiMiDi
Using latest CMake (3.29) here is a quick patch to avoid CMake Deprecation Warning:

...
[55/70] Generating lib/aliases_syshpux.h
CMake Deprecation Warning at C:/sdk/src/libiconv_cmake/cmake/gperf-static.cmake:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


[56/70] Generating lib/canonical_local.h
CMake Deprecation Warning at C:/sdk/src/libiconv_cmake/cmake/genaliases.cmake:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
...
 cmake/genaliases.cmake   | 2 +-
 cmake/gperf-static.cmake | 2 +-
 libiconv                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmake/genaliases.cmake b/cmake/genaliases.cmake
index 8f5a1d2..7c181b6 100644
--- a/cmake/genaliases.cmake
+++ b/cmake/genaliases.cmake
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.5)
 file(STRINGS ${INPUT_FILENAME} LINES)
 file(STRINGS ${PATTERNS_FILENAME} PATTERNS)
 file(WRITE ${OUTPUT_FILENAME} "")
diff --git a/cmake/gperf-static.cmake b/cmake/gperf-static.cmake
index 2278484..ae4b823 100644
--- a/cmake/gperf-static.cmake
+++ b/cmake/gperf-static.cmake
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.5)
 file(READ ${INPUT_FILENAME} INPUT)
 string(REGEX REPLACE "\n(const struct alias )" "\nstatic \\1" INPUT "${INPUT}")
 file(WRITE ${OUTPUT_FILENAME} "${INPUT}")
diff --git a/libiconv b/libiconv
index ed5f51f..5448df5 160000
--- a/libiconv
+++ b/libiconv
@@ -1 +1 @@
-Subproject commit ed5f51f1892fad39047c172344336eb8cc125c48
+Subproject commit 5448df580c4287b7bfe59d3be0dcbb2227e641d1-dirty

As U can see, also updated commit ref of libiconv to latest one

libiconv_cmake 存在过于繁琐的配置和编译流程

我发现您的libiconv_cmake步骤过于繁琐,如果只生成libiconv而非iconv program,很多部分是不必要的。

繁琐的配置编译流程会大幅减慢配置和编译

  • 经过我的测试,您的libiconv_cmake配置与编译总共用时 1:26.40
    这是配置和编译日志
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.36.32532.0
-- The CXX compiler identification is MSVC 19.36.32532.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ptrdiff_t
-- Check size of ptrdiff_t - done
-- Check size of sig_atomic_t
-- Check size of sig_atomic_t - failed
-- Check size of size_t
-- Check size of size_t - done
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Check size of wint_t
-- Check size of wint_t - done
-- Looking for alloca
-- Looking for alloca - not found
-- Looking for include file alloca.h
-- Looking for include file alloca.h - not found
-- Looking for canonicalize_file_name
-- Looking for canonicalize_file_name - not found
-- Looking for CFLocaleCopyCurrent
-- Looking for CFLocaleCopyCurrent - not found
-- Looking for CoreFoundation
-- Looking for CoreFoundation - not found
-- Looking for dcgettext
-- Looking for dcgettext - not found
-- Looking for canonicalize_file_name
-- Looking for canonicalize_file_name - not found
-- Looking for clearerr_unlocked
-- Looking for clearerr_unlocked - not found
-- Looking for feof_unlocked
-- Looking for feof_unlocked - not found
-- Looking for ferror_unlocked
-- Looking for ferror_unlocked - not found
-- Looking for fflush_unlocked
-- Looking for fflush_unlocked - not found
-- Looking for fgets_unlocked
-- Looking for fgets_unlocked - not found
-- Looking for fputc_unlocked
-- Looking for fputc_unlocked - not found
-- Looking for fputs_unlocked
-- Looking for fputs_unlocked - not found
-- Looking for fread_unlocked
-- Looking for fread_unlocked - not found
-- Looking for fwrite_unlocked
-- Looking for fwrite_unlocked - not found
-- Looking for getchar_unlocked
-- Looking for getchar_unlocked - not found
-- Looking for getc_unlocked
-- Looking for getc_unlocked - not found
-- Looking for putchar_unlocked
-- Looking for putchar_unlocked - not found
-- Looking for putc_unlocked
-- Looking for putc_unlocked - not found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - not found
-- Looking for include file dlfcn.h
-- Looking for include file dlfcn.h - not found
-- Looking for environ
-- Looking for environ - not found
-- Looking for include file errno.h
-- Looking for include file errno.h - found
-- Looking for getcwd
-- Looking for getcwd - found
-- Looking for getc_unlocked
-- Looking for getc_unlocked - not found
-- Looking for gettext
-- Looking for gettext - not found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file langinfo.h
-- Looking for include file langinfo.h - not found
-- Check size of long long int
-- Check size of long long int - done
-- Looking for include file mach-o/dyld.h
-- Looking for include file mach-o/dyld.h - not found
-- Looking for mbrtowc
-- Looking for mbrtowc - found
-- Looking for mbsinit
-- Looking for mbsinit - not found
-- Looking for mbstate_t
-- Looking for mbstate_t - not found
-- Looking for memmove
-- Looking for memmove - found
-- Looking for include file memory.h
-- Looking for include file memory.h - found
-- Looking for pathconf
-- Looking for pathconf - not found
-- Looking for include file random.h
-- Looking for include file random.h - not found
-- Looking for readlink
-- Looking for readlink - not found
-- Looking for include file search.h
-- Looking for include file search.h - found
-- Looking for setenv
-- Looking for setenv - not found
-- Looking for setlocale
-- Looking for setlocale - found
-- Looking for include file signal.h
-- Looking for include file signal.h - found
-- Looking for sigset_t
-- Looking for sigset_t - not found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- Looking for include file stdio.h
-- Looking for include file stdio.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file strerror_r
-- Looking for include file strerror_r - not found
-- Looking for include file strings.h
-- Looking for include file strings.h - not found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file sys/bitypes.h
-- Looking for include file sys/bitypes.h - not found
-- Looking for include file sys/inttypes.h
-- Looking for include file sys/inttypes.h - not found
-- Looking for include file sys/param.h
-- Looking for include file sys/param.h - not found
-- Looking for include file sys/socket.h
-- Looking for include file sys/socket.h - not found
-- Looking for include file sys/stat.h
-- Looking for include file sys/stat.h - found
-- Looking for tsearch
-- Looking for tsearch - not found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Check size of unsigned long long int
-- Check size of unsigned long long int - done
-- Looking for include file wchar.h
-- Looking for include file wchar.h - found
-- Looking for wchar_t
-- Looking for wchar_t - not found
-- Looking for wcrtomb
-- Looking for wcrtomb - found
-- Check size of wint_t
-- Check size of wint_t - done
-- Check size of _Bool
-- Check size of _Bool - done
-- Looking for _NSGetExecutablePath
-- Looking for _NSGetExecutablePath - not found
-- Configuring done (82.2s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/***/Desktop/libiconv_cmake/build
MSBuild version 17.6.3+07e294721 for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/***/Desktop/libiconv_cmake/CMakeLists.txt
  iconv.c
  localcharset.c
  正在生成代码...
  iconv.vcxproj -> C:\Users\***\Desktop\libiconv_cmake\build\Debug\iconv_Debug.lib
  Building Custom Rule C:/Users/**/Desktop/libiconv_cmake/CMakeLists.txt
  • 这是我重新分发后的GNU LIBICONV,叫做cppp-reiconv,它同样基于GNU LIBICONV,同样只生成动态和静态库,经过我的测试,当其他条件相同时,cppp-reiconv编译用时 00:15.95 ,相比libiconv_cmake速度快了大约5倍

这是配置和编译日志

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.36.32532.0
-- The CXX compiler identification is MSVC 19.36.32532.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Using 'C:/Users/***/Desktop/cppp-reiconv/build-aux/cmake' for CMake build-aux directory.
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Looking for wcrtomb
-- Looking for wcrtomb - found
-- Looking for mbrtowc
-- Looking for mbrtowc - found
-- Configuring done (11.6s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/***/Desktop/cppp-reiconv/build
MSBuild version 17.6.3+07e294721 for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/***/Desktop/cppp-reiconv/CMakeLists.txt
  iconv.c
  cppp-reiconv.a.vcxproj -> C:\Users\***\Desktop\cppp-reiconv\build\lib\Debug\cppp-reiconv.a.lib
  Building Custom Rule C:/Users/***/Desktop/cppp-reiconv/CMakeLists.txt
  iconv.c
    正在创建库 C:/Users/***/Desktop/cppp-reiconv/build/lib/Debug/cppp-reiconv.lib 和对象 C:/Users/***/Desktop/cppp-reiconv/build/lib/Debug/cppp-reiconv.exp
  cppp-reiconv.so.vcxproj -> C:\Users\***\Desktop\cppp-reiconv\build\Debug\cppp-reiconv.dll
  Building Custom Rule C:/Users/***/Desktop/cppp-reiconv/CMakeLists.txt

两者均通过了GNU LIBICONV的测试

为什么会出现这种情况?

您的libiconv_cmake生成时,对config-cmake.h.in进行了生成,它是从config.h.in改过来的,/config.h是为了iconv program使用的,libiconv完全不需要!

如何解决这个问题?

您不应生成/config-cmake.h.in,您应该生成的是lib/config.h.in,这才是libiconv使用的正确的config.h

附录

cppp-reiconv v2.0.0使用的CMakeLists.txt: CMakeLists.txt
cppp-reiconv v2.0.0源码分发包: cppp-reiconv-release-v2.0.0-dist.zip
cppp-reiconv v2.0.0的Release链接cppp-reiconv-release-v2.0.0

另外

建议您为您贡献的文件打上您的Copyright或Copyleft标识,这样有利于遵守LGPLv2.1许可证
另外,Bruno Haible会在libiconv开发仓库上解决一些bug,您可以定期关注

谢谢

2023/6/18

Fix include install PATH

hi @AiMiDi
According to generated iconv-config.cmake, include files must be installed in set(Iconv_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include")
But actually, CMakeLists.txt install them in DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME} which cause the following error on find_package / find_dependency for build requiring iconv:

CMake Error at C:/sdk/softs/cmake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Iconv (missing: Iconv_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/sdk/softs/cmake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/sdk/softs/cmake/share/cmake-3.29/Modules/FindIconv.cmake:165 (find_package_handle_standard_args)

this patch fix it

 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd2a9a4..9edb651 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -423,9 +423,9 @@ if(MSVC)
 	endif()
 endif()
 
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcharset/include/libcharset.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME} RENAME libcharset.h COMPONENT development)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcharset/include/localcharset.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME} RENAME localcharset.h COMPONENT development)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/iconv.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME} RENAME iconv.h COMPONENT development)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcharset/include/libcharset.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} RENAME libcharset.h COMPONENT development)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcharset/include/localcharset.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} RENAME localcharset.h COMPONENT development)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/iconv.h.inst DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} RENAME iconv.h COMPONENT development)
 
 if(NOT CMAKE_VERSION VERSION_LESS 3.12)
 	install(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.