2018-06-05 09:03:38 +08:00
|
|
|
# a helper function which appends source to the target
|
|
|
|
# sources file names are relative to the the target source dir
|
2016-04-17 06:55:45 +08:00
|
|
|
|
2018-06-05 09:03:38 +08:00
|
|
|
function (qbt_target_sources _target _scope)
|
|
|
|
get_target_property(targetSourceDir ${_target} SOURCE_DIR)
|
|
|
|
set(sourcesRelative "")
|
|
|
|
foreach(source IN ITEMS ${ARGN})
|
|
|
|
if(IS_ABSOLUTE "${source}")
|
|
|
|
set(sourceAbsolutePath "${source}")
|
2016-04-17 06:55:45 +08:00
|
|
|
else()
|
2018-06-05 09:03:38 +08:00
|
|
|
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
|
2016-04-17 06:55:45 +08:00
|
|
|
endif()
|
2018-06-05 09:03:38 +08:00
|
|
|
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
|
|
|
|
list(APPEND sourcesRelative "${sourceRelativePath}")
|
2016-04-17 06:55:45 +08:00
|
|
|
endforeach()
|
2018-06-05 09:03:38 +08:00
|
|
|
target_sources(${_target} ${_scope} "${sourcesRelative}")
|
|
|
|
endfunction(qbt_target_sources)
|