diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-03-30 16:06:56 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-30 16:06:56 -0700 |
commit | 499aeaf645146fff4aa369ac7fb07d383d8843e5 (patch) | |
tree | 60fa42d99ebbea422afcadbc391f77ba4569c0a4 /CMakeLists.txt | |
parent | eecf40c121274108923885dec386c908b575883c (diff) | |
download | subsurface-499aeaf645146fff4aa369ac7fb07d383d8843e5.tar.gz |
cmake: create translations and correctly install them
The previous attempt to install them was completely bogus as it only
worked when the source directory had previously used for an in-source
build using qmake.
Oops.
With this change we now create the translations in the build directory and
install them from there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 758d3cf28..7eebc0c78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,15 +139,24 @@ ADD_CUSTOM_TARGET(version ALL COMMAND SET(PLATFORM_SRC unknown_platform.c) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") SET(PLATFORM_SRC linux.c) + if(NOT DEFINED LRELEASE) + set(LRELEASE lrelease) + endif() ENDIF() IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(PLATFORM_SRC macos.c) set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -framework CoreServices) + if(NOT DEFINED LRELEASE) + set(LRELEASE lrelease) + endif() ENDIF() IF(CMAKE_SYSTEM_NAME STREQUAL "Windows") SET(PLATFORM_SRC windows.c) set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32) remove_definitions(-DUNICODE) + if(NOT DEFINED LRELEASE) + set(LRELEASE lrelease.exe) + endif() ENDIF() # compile the core library, in C. @@ -374,10 +383,21 @@ set(TRANSLATION_SRC # into a single string, so we assemble it file name by file name foreach(TRANSLATION ${TRANSLATION_SRC}) string(REGEX REPLACE \\.ts .qm TRANSLATION_QM ${TRANSLATION}) - set(TRANSLATIONS ${TRANSLATIONS} ${TRANSLATION_QM}) + string(REGEX REPLACE "/" "-" TRANSLATION_TARGET ${TRANSLATION_QM}) + MESSAGE(STATUS ${TRANSLATION} "->" ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_BINARY_DIR}/${TRANSLATION_QM} + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/translations \\; ${LRELEASE} ${CMAKE_SOURCE_DIR}/${TRANSLATION} -qm ${CMAKE_BINARY_DIR}/${TRANSLATION_QM} + DEPENDS ${TRANSLATION} + ) + ADD_CUSTOM_TARGET( + generate_translations_${TRANSLATION_TARGET} + DEPENDS ${CMAKE_BINARY_DIR}/${TRANSLATION_QM} + ) + ADD_DEPENDENCIES(subsurface generate_translations_${TRANSLATION_TARGET}) + set(TRANSLATIONS ${TRANSLATIONS} ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}) endforeach() - # now for each platform the install instructions if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |