Mercurial > minori
comparison CMakeLists.txt @ 112:80f49f623d30
locale: allow switching locales without restarting
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 06 Nov 2023 13:41:30 -0500 |
parents | 2f3ae79adb02 |
children | ab191e28e69d |
comparison
equal
deleted
inserted
replaced
111:fcae8bece0ec | 112:80f49f623d30 |
---|---|
133 # dumb little hack to get this working on Qt5 and Qt6 | 133 # dumb little hack to get this working on Qt5 and Qt6 |
134 if(UPDATE_TRANSLATIONS) | 134 if(UPDATE_TRANSLATIONS) |
135 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") | 135 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") |
136 endif() | 136 endif() |
137 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) | 137 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) |
138 add_custom_target(translation SOURCES ${QM_FILES} DEPENDS ${TS_FILES}) | 138 list(APPEND SRC_FILES ${QM_FILES}) |
139 | 139 |
140 function(qt_create_resource_file outfile) | 140 function(qt_create_resource_file outfile) |
141 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") | 141 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") |
142 get_filename_component(DIR ${outfile} DIRECTORY) | 142 get_filename_component(DIR ${outfile} DIRECTORY) |
143 foreach (qm ${ARGN}) | 143 foreach (qm ${ARGN}) |
147 string(APPEND QRC "\t</qresource>\n</RCC>\n") | 147 string(APPEND QRC "\t</qresource>\n</RCC>\n") |
148 file(WRITE ${outfile} ${QRC}) | 148 file(WRITE ${outfile} ${QRC}) |
149 endfunction() | 149 endfunction() |
150 | 150 |
151 qt_create_resource_file("${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc" ${QM_FILES}) | 151 qt_create_resource_file("${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc" ${QM_FILES}) |
152 add_custom_target(resources DEPENDS translation SOURCES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") | 152 list(APPEND SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") |
153 | 153 |
154 # This is also used in the Win32 rc file | 154 # This is also used in the Win32 rc file |
155 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") | 155 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") |
156 | 156 |
157 if(APPLE) # Mac OS X (or OS X (or macOS)) | 157 if(APPLE) # Mac OS X (or OS X (or macOS)) |
181 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | 181 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc |
182 ) | 182 ) |
183 endif() | 183 endif() |
184 | 184 |
185 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) | 185 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) |
186 add_dependencies(minori resources) | |
187 set_property(TARGET minori PROPERTY CXX_STANDARD 11) | 186 set_property(TARGET minori PROPERTY CXX_STANDARD 11) |
188 set_property(TARGET minori PROPERTY AUTOMOC ON) | 187 set_property(TARGET minori PROPERTY AUTOMOC ON) |
189 set_property(TARGET minori PROPERTY AUTORCC ON) | 188 set_property(TARGET minori PROPERTY AUTORCC ON) |
190 | 189 |
191 target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE ${INCLUDE}) | 190 target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE ${INCLUDE}) |