From c2264ffbe3892d28930b89b0123efc369cabc143 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 17 Feb 2024 15:35:35 +0200 Subject: [PATCH] CMake: Build lzmainfo. --- CMakeLists.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 043c3151..7bee66b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1443,6 +1443,60 @@ if(HAVE_DECODERS AND (NOT MSVC OR MSVC_VERSION GREATER_EQUAL 1900)) endif() +############################################################################# +# lzmainfo +############################################################################# + +if(HAVE_DECODERS AND (NOT MSVC OR MSVC_VERSION GREATER_EQUAL 1900)) + add_executable(lzmainfo + src/common/sysdefs.h + src/common/tuklib_common.h + src/common/tuklib_config.h + src/common/tuklib_exit.c + src/common/tuklib_exit.h + src/common/tuklib_gettext.h + src/common/tuklib_progname.c + src/common/tuklib_progname.h + src/lzmainfo/lzmainfo.c + ) + + target_include_directories(lzmainfo PRIVATE + src/common + src/liblzma/api + ) + + target_link_libraries(lzmainfo PRIVATE liblzma libgnu) + + if(WIN32) + # Add the Windows resource file for lzmainfo.exe. + target_sources(lzmainfo PRIVATE src/lzmainfo/lzmainfo_w32res.rc) + set_target_properties(lzmainfo PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" + ) + endif() + + tuklib_progname(lzmainfo) + + # NOTE: The translations are in the "xz" domain and the .mo files are + # installed as part of the "xz" target. + if(ENABLE_NLS) + target_compile_definitions(lzmainfo PRIVATE + ENABLE_NLS + PACKAGE="${TRANSLATION_DOMAIN}" + LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}" + ) + endif() + + install(TARGETS lzmainfo + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT lzmainfo) + + if(UNIX) + my_install_man(lzmainfo src/lzmainfo/lzmainfo.1 "") + endif() +endif() + + ############################################################################# # xz #############################################################################