diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 84778b3e..5e0ad91a 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -23,7 +23,9 @@ add_executable(traintastic-client gfx/common.qrc gfx/dark/dark.qrc gfx/light/light.qrc - ${TRANSLATION_FILES}) +) + +add_dependencies(traintastic-client traintastic-lang) add_definitions(-DQT_DEPRECATED_WARNINGS) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index e1f9d7a8..d2fefe43 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -20,8 +20,11 @@ if(ENABLE_CLANG_TIDY) set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=-*,readability-*,-readability-braces-around-statements,-readability-implicit-bool-conversion,-readability-magic-numbers) endif() -add_executable(traintastic-server src/main.cpp src/options.hpp ${TRANSLATION_FILES}) -add_executable(traintastic-server-test test/main.cpp ${TRANSLATION_FILES}) +add_executable(traintastic-server src/main.cpp src/options.hpp) +add_executable(traintastic-server-test test/main.cpp) + +add_dependencies(traintastic-server traintastic-lang) +add_dependencies(traintastic-server-test traintastic-lang) target_compile_definitions(traintastic-server-test PRIVATE -DTRAINTASTIC_TEST) diff --git a/shared/translations/traintastic-lang.cmake b/shared/translations/traintastic-lang.cmake index 4b3b5b35..76377474 100644 --- a/shared/translations/traintastic-lang.cmake +++ b/shared/translations/traintastic-lang.cmake @@ -3,9 +3,9 @@ find_package(Python3) file(GLOB TRANSLATION_FILES "${CMAKE_CURRENT_LIST_DIR}/*.json") list(TRANSFORM TRANSLATION_FILES REPLACE "[.]json$" ".lang") -add_custom_command( - OUTPUT ${TRANSLATION_FILES} - COMMAND Python3::Interpreter json2lang.py +add_custom_target( + traintastic-lang ALL + Python3::Interpreter json2lang.py + COMMENT "Updating language files" WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - DEPENDS ${TRANSLATION_SRC_FILES} )