diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f38d40..1520e311 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,11 +380,7 @@ if(NOT ENABLE_ASM_CORE) add_definitions(-DC_CORE) endif() -set(NLS_DEFAULT OFF) - -if(NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg) - set(NLS_DEFAULT ON) -endif() +set(NLS_DEFAULT ON) option(ENABLE_NLS "Enable translations" ${NLS_DEFAULT}) @@ -402,17 +398,17 @@ if(ENABLE_NLS) set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin") endif() endif() - if(ENABLE_LINK) + if(ENABLE_LINK OR ENABLE_WX) find_path(LIBINTL_INC libintl.h) - find_library(LIBINTL_LIB intl) - find_library(LIBICONV_LIB iconv) + find_library(LIBINTL_LIB NAMES intl libintl) + find_library(LIBICONV_LIB NAMES iconv libiconv) if(LIBINTL_LIB) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBINTL_LIB}) - set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${LIBINTL_LIB}) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB}) + list(APPEND VBAMCORE_LIBS ${LIBINTL_LIB}) endif() if(LIBICONV_LIB) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBICONV_LIB}) - set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${LIBICONV_LIB}) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB}) + list(APPEND VBAMCORE_LIBS ${LIBICONV_LIB}) endif() include(CheckFunctionExists) check_function_exists(gettext GETTEXT_FN) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 752bc58c..a3c9ff9f 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -528,6 +528,28 @@ endif() # wxWidgets checks if(CMAKE_TOOLCHAIN_FILE MATCHES vcpkg) find_package(unofficial-gettext REQUIRED) + + if(MSVC) + # install gettext tools from nuget + + # first fetch the nuget binary + if(NOT EXISTS ${CMAKE_BINARY_DIR}/nuget.exe) + file(DOWNLOAD "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" ${CMAKE_BINARY_DIR}/nuget.exe) + endif() + + # install the Gettext.Tools package + execute_process( + COMMAND nuget.exe install Gettext.Tools -OutputDirectory ${CMAKE_BINARY_DIR}/nuget + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + + # find the path to the binaries in the package and add them to find path + file(GLOB pkg ${CMAKE_BINARY_DIR}/nuget/*) + + list(APPEND CMAKE_PROGRAM_PATH ${pkg}/tools/bin) + + find_package(Gettext REQUIRED) + endif() else() find_package(Gettext REQUIRED)