-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtility.cmake
More file actions
33 lines (29 loc) · 1.25 KB
/
Utility.cmake
File metadata and controls
33 lines (29 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
macro(add_module target module)
file(GLOB qml_files qml/*.qml)
file(GLOB_RECURSE resources resources/*)
file(GLOB_RECURSE include *.h)
file(GLOB src src/*.cpp)
foreach(file ${qml_files} ${src})
get_filename_component(file_name ${file} NAME)
set_source_files_properties(${file} PROPERTIES QT_RESOURCE_ALIAS "${file_name}")
endforeach()
foreach (file ${resources} ${include})
file(RELATIVE_PATH relative_file ${CMAKE_CURRENT_SOURCE_DIR} ${file})
set_source_files_properties(${file} PROPERTIES QT_RESOURCE_ALIAS "${relative_file}")
endforeach()
qt_add_qml_module(${module} STATIC
URI ${target}
VERSION 1.0
RESOURCE_PREFIX /
QML_FILES ${qml_files}
RESOURCES ${resources}
SOURCES ${include} ${src}
)
foreach(file ${include})
get_filename_component(path ${file} DIRECTORY)
target_include_directories(${module} PRIVATE ${path})
message(STATUS "Include path: ${path}")
endforeach()
target_include_directories(${module} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "Include path: ${CMAKE_CURRENT_SOURCE_DIR}")
endmacro()