12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- cmake_minimum_required(VERSION 3.0)
- project(w2midi_qt)
- set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
- set(CMAKE_AUTOMOC ON)
- set(CMAKE_AUTORCC ON)
- set(CMAKE_AUTOUIC ON)
- if(CMAKE_VERSION VERSION_LESS "3.7.0")
- set(CMAKE_INCLUDE_CURRENT_DIR ON)
- endif()
- set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra")
- set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra -Werror -O2")
- set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE)
- find_package(Qt5 COMPONENTS Widgets REQUIRED)
- set(TS_FILES
- ${CMAKE_SOURCE_DIR}/lang/ru_RU.ts
- )
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lang) # create directory for lrelease output (it does not created autmatically by lrelease)
- find_package(Qt5 COMPONENTS ${REQUIRED_LIBS} LinguistTools REQUIRED) # finding LinguistTools
- #configure_file(icons.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
- configure_file(translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) # copy translations.qrc file to buld directory. It is needed because rcc searches resources in path relative to .qrc file
- qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES}) # this should regenerate .ts files automatically but currently will remove old one when asking for rebuild. Which is undesirable. See QTBUG-96549 and https://forum.qt.io/topic/130308
- set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "lang") # set qm files output directory
- qt5_add_translation(QM_FILES ${TS_FILES}) # generate qm files
- add_executable(w2midi_qt
- main.cpp
- cli.cpp
- app.cpp
- slider.cpp
- clickablelabel.cpp
- ${QM_FILES}
- ${TS_FILES}
- ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
- icons.qrc
- )
- target_link_libraries(w2midi_qt Qt5::Widgets)
- install(TARGETS w2midi_qt)
- install(DIRECTORY icons/hicolor DESTINATION /usr/share/icons/)
- install(FILES w2midi_qt.desktop DESTINATION /usr/share/applications/)
|