vcpkg/ports/libiconv/CMakeLists.txt

48 lines
1.7 KiB
CMake
Raw Normal View History

2016-10-05 10:30:00 +08:00
cmake_minimum_required(VERSION 3.0.0)
2017-11-24 19:07:33 +08:00
project(libiconv C)
if(BUILD_SHARED_LIBS)
set(LIBICONV_DYNAMIC "1 /*LIBICONV_DYNAMIC*/")
else()
set(LIBICONV_DYNAMIC "0 /*LIBICONV_DYNAMIC*/")
endif()
set(HAVE_WCHAR_T "1 /*HAVE_WCHAR_T*/")
set(USE_MBSTATE_T "0 /*USE_MBSTATE_T*/")
set(BROKEN_WCHAR_H "0 /*BROKEN_WCHAR_H*/")
set(HAVE_VISIBILITY "0 /*HAVE_VISIBILITY*/")
2017-11-24 19:07:33 +08:00
configure_file(config.h.in config.h)
file(READ "${CMAKE_CURRENT_BINARY_DIR}/config.h" _contents)
string(REPLACE "#undef HAVE_WORKING_O_NOFOLLOW" "#define HAVE_WORKING_O_NOFOLLOW 0" _contents "${_contents}")
string(REPLACE "#undef HAVE_MBRTOWC" "#define HAVE_MBRTOWC 1" _contents "${_contents}")
string(REPLACE "#undef HAVE_MBSINIT" "#define HAVE_MBSINIT 1" _contents "${_contents}")
string(REPLACE "#undef HAVE_WCRTOMB" "#define HAVE_WCRTOMB 1" _contents "${_contents}")
string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" _contents "${_contents}")
string(REPLACE "#undef EILSEQ" "" _contents "${_contents}")
string(REPLACE "#undef WORDS_LITTLEENDIAN" "#define WORDS_LITTLEENDIAN 1" _contents "${_contents}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}")
2016-10-05 10:30:00 +08:00
2017-11-24 19:07:33 +08:00
configure_file(libcharset/include/localcharset.h.build.in localcharset.h)
configure_file(include/iconv.h.build.in iconv.h)
2016-10-05 10:30:00 +08:00
2017-11-24 19:07:33 +08:00
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
2016-10-05 10:30:00 +08:00
2017-11-24 19:07:33 +08:00
add_definitions(-DLIBDIR -D_CRT_SECURE_NO_WARNINGS)
2016-11-29 05:01:55 +08:00
2017-11-24 19:07:33 +08:00
add_library(libcharset libcharset/lib/localcharset.c)
2016-10-05 10:30:00 +08:00
2017-11-24 19:07:33 +08:00
add_library(libiconv lib/iconv.c)
target_link_libraries(libiconv libcharset)
2016-10-05 10:30:00 +08:00
2017-11-24 19:07:33 +08:00
install(TARGETS libcharset libiconv
2016-10-05 10:30:00 +08:00
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
2017-11-24 19:07:33 +08:00
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/iconv.h
${CMAKE_CURRENT_BINARY_DIR}/localcharset.h
DESTINATION include
)