Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
e5eda9f1
Commit
e5eda9f1
authored
Sep 04, 2014
by
Fabio Bas
Browse files
Add a UPDATE_TRANSLATIONS options that actually updates translations!
parent
8c072224
Changes
2
Show whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
e5eda9f1
...
...
@@ -102,7 +102,9 @@ ENDIF()
# Find Qt and enable the needed features
# Default is Qt5 unless WITH_QT4 option is enabled
option
(
WITH_QT4
"Force thr use of Qt4 libraries"
OFF
)
option
(
WITH_QT4
"Force the use of Qt4 libraries"
OFF
)
OPTION
(
UPDATE_TRANSLATIONS
"Update translations on compile"
OFF
)
MESSAGE
(
"UPDATE TRANSLATIONS:
${
UPDATE_TRANSLATIONS
}
"
)
IF
(
NOT WITH_QT4
)
FIND_PACKAGE
(
Qt5Widgets
)
...
...
@@ -115,6 +117,18 @@ IF(Qt5Widgets_FOUND)
# FIX: Qt was built with -reduce-relocations
add_definitions
(
-fPIC
)
endif
()
FIND_PACKAGE
(
Qt5LinguistTools
)
IF
(
UPDATE_TRANSLATIONS
)
IF
(
NOT Qt5_LUPDATE_EXECUTABLE
)
MESSAGE
(
WARNING
"Qt's lupdate not found."
)
ENDIF
()
ENDIF
()
IF
(
NOT Qt5_LRELEASE_EXECUTABLE
)
MESSAGE
(
WARNING
"Qt's lrelease not found."
)
ENDIF
()
ELSE
()
FIND_PACKAGE
(
Qt4 4.8.0 REQUIRED
)
IF
(
QT4_FOUND
)
...
...
@@ -123,6 +137,17 @@ ELSE()
ENDIF
()
IF
(
Qt4_FOUND
)
MESSAGE
(
STATUS
"Found Qt
${
QT_VERSION_MAJOR
}
.
${
QT_VERSION_MINOR
}
.
${
QT_VERSION_PATCH
}
"
)
IF
(
UPDATE_TRANSLATIONS
)
IF
(
NOT QT_LUPDATE_EXECUTABLE
)
MESSAGE
(
WARNING
"Qt's lupdate not found."
)
ENDIF
()
ENDIF
()
IF
(
NOT QT_LRELEASE_EXECUTABLE
)
MESSAGE
(
WARNING
"Qt's lrelease not found."
)
ENDIF
()
ELSE
()
MESSAGE
(
FATAL_ERROR
"No Qt4 or Qt5 found!"
)
ENDIF
()
...
...
cockatrice/CMakeLists.txt
View file @
e5eda9f1
...
...
@@ -115,6 +115,12 @@ set(cockatrice_TS
# translations/cockatrice_zh_CN.ts
)
IF
(
UPDATE_TRANSLATIONS
)
FILE
(
GLOB_RECURSE translate_cockatrice_SRCS
${
CMAKE_SOURCE_DIR
}
/cockatrice/src/*.cpp
)
FILE
(
GLOB_RECURSE translate_common_SRCS
${
CMAKE_CURRENT_SOURCE_DIR
}
/common/*.cpp
)
SET
(
translate_SRCS
${
translate_cockatrice_SRCS
}
${
translate_common_SRCS
}
)
ENDIF
(
UPDATE_TRANSLATIONS
)
if
(
WIN32
)
set
(
cockatrice_SOURCES
${
cockatrice_SOURCES
}
cockatrice.rc
)
endif
(
WIN32
)
...
...
@@ -149,7 +155,12 @@ if(Qt4_FOUND)
# Let cmake chew Qt4's translations and resource files
# Note: header files are MOC-ed automatically by cmake
IF
(
UPDATE_TRANSLATIONS
)
QT4_CREATE_TRANSLATION
(
cockatrice_QM
${
translate_SRCS
}
${
cockatrice_TS
}
)
ELSE
(
UPDATE_TRANSLATIONS
)
QT4_ADD_TRANSLATION
(
cockatrice_QM
${
cockatrice_TS
}
)
ENDIF
(
UPDATE_TRANSLATIONS
)
QT4_ADD_RESOURCES
(
cockatrice_RESOURCES_RCC
${
cockatrice_RESOURCES
}
)
endif
()
...
...
@@ -202,7 +213,12 @@ if(Qt5Widgets_FOUND)
# Let cmake chew Qt5's translations and resource files
# Note: header files are MOC-ed automatically by cmake
IF
(
UPDATE_TRANSLATIONS
)
QT5_CREATE_TRANSLATION
(
cockatrice_QM
${
translate_SRCS
}
${
cockatrice_TS
}
)
ELSE
()
QT5_ADD_TRANSLATION
(
cockatrice_QM
${
cockatrice_TS
}
)
ENDIF
()
QT5_ADD_RESOURCES
(
cockatrice_RESOURCES_RCC
${
cockatrice_RESOURCES
}
)
# guess plugins and libraries directory
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment