diff options
| author | 2016-09-25 10:04:28 +0200 | |
|---|---|---|
| committer | 2016-09-25 10:04:28 +0200 | |
| commit | fac053c3aacc0e2ede8a85ff41e27eed1c360f6f (patch) | |
| tree | c91ff176e60f1f6e634107b4e7a7282e831975ee /cli/CMakeLists.txt | |
| parent | dbb57d52d351e340ce69fccaedbdf758b04ed8fe (diff) | |
| parent | e225f2edfd365d1709df2cb5bb2f752ec8d82c1c (diff) | |
| download | OneRoll-fac053c3aacc0e2ede8a85ff41e27eed1c360f6f.tar.gz OneRoll-fac053c3aacc0e2ede8a85ff41e27eed1c360f6f.zip | |
Merge branch 'master' of github.com:Rolisteam/DiceParser
Diffstat (limited to 'cli/CMakeLists.txt')
| -rw-r--r-- | cli/CMakeLists.txt | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 9497b41..680d1b8 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 2.8) +option(UPDATE_TRANSLATIONS "update Translation" OFF) +MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}") + project(dice) + + # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. @@ -12,19 +17,48 @@ find_package(Qt5Core) set(EXECUTABLE_OUTPUT_PATH bin/) - include_directories(${Qt5Core_INCLUDES} ../) add_definitions(${Qt5Core_DEFINITIONS}) set(MODE "cli") - ADD_DEFINITIONS( -std=c++11 # Or -std=c++0x # Other flags ) -add_executable( - dice + +set(dice_RESOURCES diceparser.qrc) +FIND_PACKAGE(Qt5LinguistTools) + + +IF(UPDATE_TRANSLATIONS) + MESSAGE( update Translation ) + FILE(GLOB_RECURSE translate_dice_SRCS ../*.cpp ../*.h) + SET(translate_SRCS ${translate_dice_SRCS}) + SET(dice_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/dice_en.ts" "${CMAKE_CURRENT_SOURCE_DIR}/i18n/dice_fr.ts") +ELSE() + MESSAGE( NO updates for translations) + FILE(GLOB dice_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/*.ts") +ENDIF(UPDATE_TRANSLATIONS) + +if(Qt5Core_FOUND) + + IF(UPDATE_TRANSLATIONS) + MESSAGE(status "find" ${dice_TS} ${translate_SRCS} ) + QT5_CREATE_TRANSLATION(dice_QM ${translate_SRCS} ${dice_TS}) + ELSE() + QT5_ADD_TRANSLATION(dice_QM ${dice_TS}) + ENDIF() + + QT5_ADD_RESOURCES(dice_RESOURCES_RCC ${dice_RESOURCES}) + + # guess plugins and libraries directory + set(QT_PLUGINS_DIR "${Qt5Core_DIR}/../../../plugins") + get_target_property(QT_LIBRARY_DIR Qt5::Core LOCATION) + get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH) +endif() + +SET( dice_sources ../diceparser.cpp ../range.cpp ../booleancondition.cpp @@ -58,10 +92,11 @@ add_executable( ../node/ifnode.cpp main.cpp ../highlightdice.cpp - ) +) + +add_executable( dice ${dice_sources} ${dice_QM} ) target_link_libraries(dice ${Qt5Core_LIBRARIES}) INSTALL_TARGETS(/bin dice) #qt5_use_modules() - |