build: MSVC Compat

pull/1/head
PikachuHy 4 years ago
parent 13b72f5180
commit 58f3bb3ce8

@ -12,7 +12,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(QT Core Gui Quick QuickControls2 LinguistTools)
find_package(Qt5 REQUIRED ${QT})
if (MSVC)
# fix warning C4819: The file contains a character that cannot be represented in the current code page (936).
# Save the file in Unicode format to prevent data loss
add_compile_options("/utf-8")
endif ()
set(SRCS
main.cpp
calcengine.cpp
@ -33,11 +37,15 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Quick
Qt5::QuickControls2
)
if (MSVC)
# do nothing
else()
file(GLOB TS_FILES translations/*.ts)
qt5_create_translation(QM_FILES ${TS_FILES})
add_custom_target(translations DEPENDS ${QM_FILES} SOURCES ${TS_FILES})
add_dependencies(${PROJECT_NAME} translations)
endif ()
file(GLOB TS_FILES translations/*.ts)
qt5_create_translation(QM_FILES ${TS_FILES})
add_custom_target(translations DEPENDS ${QM_FILES} SOURCES ${TS_FILES})
add_dependencies(${PROJECT_NAME} translations)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION /usr/bin)

Loading…
Cancel
Save