mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Cmake refactor part 7
generate project source tree in all projects with sources source tree is based on real paths Change-Id: Ie10a6bffedb8020f25ebcb24a2f797086d8accbb
This commit is contained in:

committed by
sys_ocldev

parent
8f0789bd3e
commit
2466f9363f
@ -32,15 +32,23 @@ macro(add_subdirectories)
|
||||
endmacro()
|
||||
|
||||
macro(create_project_source_tree target)
|
||||
get_target_property(source_list ${target} SOURCES)
|
||||
foreach(source_file ${source_list})
|
||||
if(NOT ${source_file} MATCHES "\<*\>")
|
||||
file(RELATIVE_PATH source_file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${source_file})
|
||||
get_filename_component(source_path_relative ${source_file_relative} PATH)
|
||||
if(source_path_relative)
|
||||
string(REPLACE "/" "\\" source_path_relative ${source_path_relative})
|
||||
if(MSVC)
|
||||
set(prefixes ${CMAKE_CURRENT_SOURCE_DIR} ${ARGN})
|
||||
get_target_property(source_list ${target} SOURCES)
|
||||
foreach(source_file ${source_list})
|
||||
if(NOT ${source_file} MATCHES "\<*\>")
|
||||
set(source_file_relative ${source_file})
|
||||
foreach(prefix ${prefixes})
|
||||
if(source_file_relative)
|
||||
string(REPLACE "${prefix}" "" source_file_relative ${source_file_relative})
|
||||
endif()
|
||||
endforeach()
|
||||
get_filename_component(source_path_relative ${source_file_relative} PATH)
|
||||
if(source_path_relative)
|
||||
string(REPLACE "/" "\\" source_path_relative ${source_path_relative})
|
||||
endif()
|
||||
source_group("Source Files\\${source_path_relative}" FILES ${source_file})
|
||||
endif()
|
||||
source_group("Source Files\\${source_path_relative}" FILES ${source_file})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
Reference in New Issue
Block a user