CMake: Put the *.mo files directly in the correct output dir

Avoids the need to copy the *.mo files manually *and* more importantly
this ensures that the mo files are always recreated if the build
output directory is cleared.
This commit is contained in:
Léo Lam 2021-04-25 01:15:14 +02:00
parent e71aef6768
commit ae67a9382b
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 5 additions and 2 deletions

View File

@ -431,7 +431,11 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
foreach(po ${LINGUAS})
get_filename_component(lang ${po} NAME_WE)
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
if(WIN32)
set(mo_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang})
else()
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
endif()
set(mo ${mo_dir}/dolphin-emu.mo)
target_sources(dolphin-emu PRIVATE ${mo})
@ -447,7 +451,6 @@ if(GETTEXT_MSGFMT_EXECUTABLE)
add_custom_command(OUTPUT ${mo}
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
COMMAND ${CMAKE_COMMAND} -E copy ${mo} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Languages/${lang}/dolphin-emu.mo
DEPENDS ${po}
)
else()