2018-06-05 04:03:38 +03:00
|
|
|
# a helper function which appends source to the target
|
|
|
|
# sources file names are relative to the the target source dir
|
2016-04-17 01:55:45 +03:00
|
|
|
|
2018-06-05 04:03:38 +03: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 01:55:45 +03:00
|
|
|
else()
|
2018-06-05 04:03:38 +03:00
|
|
|
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
|
2016-04-17 01:55:45 +03:00
|
|
|
endif()
|
2018-06-05 04:03:38 +03:00
|
|
|
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
|
|
|
|
list(APPEND sourcesRelative "${sourceRelativePath}")
|
2016-04-17 01:55:45 +03:00
|
|
|
endforeach()
|
2018-06-05 04:03:38 +03:00
|
|
|
target_sources(${_target} ${_scope} "${sourcesRelative}")
|
|
|
|
endfunction(qbt_target_sources)
|