diff --git a/CMakeLists.txt b/CMakeLists.txt index ce0d60603..685f2626e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -410,6 +410,7 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) enable_testing() +option(BUILD_TRANSLATIONS "Build translations using lrelease (Qt)" OFF) option(BUILD_DOCUMENTATION "Build the Doxygen documentation." ON) option(BUILD_TESTS "Build tests." OFF) if (CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -632,8 +633,9 @@ function (monero_add_library_with_deps) PRIVATE $) endfunction () +if(BUILD_TRANSLATIONS) # Generate header for embedded translations -# Generate header for embedded translations, use target toolchain if depends, otherwise use the +# use target toolchain if depends, otherwise use the # lrelease and lupdate binaries from the host include(ExternalProject) ExternalProject_Add(generate_translations_header @@ -643,6 +645,8 @@ ExternalProject_Add(generate_translations_header CMAKE_ARGS -DLRELEASE_PATH=${LRELEASE_PATH} INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "") include_directories("${CMAKE_CURRENT_BINARY_DIR}/translations") +endif() + add_subdirectory(external) # Final setup for libunbound diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 057fbdce5..748892869 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -61,8 +61,12 @@ monero_private_headers(common monero_add_library(common ${common_sources} ${common_headers} - ${common_private_headers} - DEPENDS generate_translations_header) + ${common_private_headers}) + +if(BUILD_TRANSLATIONS) + add_dependencies(obj_common generate_translations_header) +endif() + target_link_libraries(common PUBLIC cncrypto diff --git a/src/common/i18n.cpp b/src/common/i18n.cpp index 0dacb1fdc..34d0029d7 100644 --- a/src/common/i18n.cpp +++ b/src/common/i18n.cpp @@ -33,7 +33,14 @@ #include #include "file_io_utils.h" #include "common/i18n.h" + +#if __has_include("translation_files.h") #include "translation_files.h" +#else +static bool find_embedded_file(const std::string &name, std::string &data) { + return false; +} +#endif #include #include