Home Explore Blog CI



neovim

1st chunk of `cmake.deps/cmake/LibiconvCMakeLists.txt`
e5fff75c4374b3a3af25f42068b843556d7da53a91c3191a00000001000009ed
cmake_minimum_required(VERSION 3.16)
project(libiconv C)

add_compile_options(-w)

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/srclib
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}/srclib
  ${CMAKE_CURRENT_SOURCE_DIR}/build-aux/snippet)

configure_file(config.h.in config.h)
file(READ "${CMAKE_CURRENT_BINARY_DIR}/config.h" CONFIG_CONTENT)
string(REPLACE "#undef EILSEQ" "" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_MBRTOWC" "#define HAVE_MBRTOWC 1" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_MBSINIT" "#define HAVE_MBSINIT 1" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_WCRTOMB" "#define HAVE_WCRTOMB 1" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_DECL___ARGV" "#define HAVE_DECL___ARGV 1" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_WORKING_O_NOFOLLOW" "#define HAVE_WORKING_O_NOFOLLOW 0" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef WORDS_LITTLEENDIAN" "#define WORDS_LITTLEENDIAN 1" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef HAVE_DECL_STRERROR_R" "#define HAVE_DECL_STRERROR_R 0" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef mode_t" "#define mode_t int" CONFIG_CONTENT "${CONFIG_CONTENT}")
string(REPLACE "#undef ssize_t" "#include <BaseTsd.h>\n#define ssize_t SSIZE_T" CONFIG_CONTENT "${CONFIG_CONTENT}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${CONFIG_CONTENT}")

set(BROKEN_WCHAR_H 0)
set(HAVE_VISIBILITY 0)
set(HAVE_WCHAR_T 1)
set(ICONV_CONST "const")
set(USE_MBSTATE_T 0)
configure_file(libcharset/include/localcharset.h.build.in localcharset.h)
configure_file(include/iconv.h.build.in iconv.h)

add_definitions(-DLIBDIR)

add_library(libcharset libcharset/lib/localcharset.c)

add_library(libiconv lib/iconv.c)
target_link_libraries(libiconv libcharset)

add_executable(iconv src/iconv.c srclib/progname.c srclib/getprogname.c
  srclib/safe-read.c srclib/uniwidth/width.c srclib/error.c srclib/xmalloc.c
  srclib/basename-lgpl.c)
target_link_libraries(iconv libiconv)

set(HEADER_TEMPLATES_PATH "srclib")
set(HEADER_TEMPLATES_ABS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_TEMPLATES_PATH}")
file(GLOB_RECURSE HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/*.in.h")
list(REMOVE_ITEM HEADER_TEMPLATES  "${HEADER_TEMPLATES_ABS_PATH}/stdint.in.h")
list(REMOVE_ITEM HEADER_TEMPLATES  "${HEADER_TEMPLATES_ABS_PATH}/wchar.in.h")

Title: CMake Configuration for libiconv
Summary
This CMake script configures the libiconv project. It sets compile options, includes directories, configures header files (config.h, localcharset.h, iconv.h) by replacing specific macros, defines variables (BROKEN_WCHAR_H, HAVE_VISIBILITY, HAVE_WCHAR_T, ICONV_CONST, USE_MBSTATE_T), creates libraries (libcharset, libiconv) and an executable (iconv), and links them appropriately. It also defines header templates and removes specific files from the list.