mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-25 19:21:41 +03:00
fake custom target, and qmllint
It is a small trap for that qtcreator show qml|js files, and we can use qmllint before the each build, and avoid some syntax errors.
This commit is contained in:
parent
5b1ab3fc68
commit
44f9cfc01a
34
FakeTarget.cmake
Normal file
34
FakeTarget.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
execute_process(COMMAND find plasmoid containment -name "*.qml" -o -name "*.js"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE QML_SRCS_STRING)
|
||||
|
||||
string(REPLACE "\n" ";" QML_SRCS ${QML_SRCS_STRING})
|
||||
|
||||
# fake target for QtCreator project
|
||||
add_custom_target(fake-target
|
||||
SOURCES ${QML_SRCS}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
# qmllint: qml static syntax checker
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
||||
find_program(QMLLINT qmllint)
|
||||
|
||||
if(EXISTS "${QMLLINT}")
|
||||
message("-- Found qmllint: ${QMLLINT}")
|
||||
add_custom_command(TARGET candil PRE_BUILD
|
||||
COMMAND ${QMLLINT} ${QML_SRCS}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Running qmllint")
|
||||
else()
|
||||
message("-- qmllint: QML Syntax verifier not found")
|
||||
endif()
|
||||
|
||||
message("-- Enabling QML debugging and profiling")
|
||||
add_definitions(-DQT_QML_DEBUG)
|
||||
add_definitions(-DQT_FATAL_WARNINGS)
|
||||
|
||||
elseif(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
message("-- Disabling debug info")
|
||||
add_definitions(-DQT_NO_DEBUG)
|
||||
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user