Pre-compute gt_src_list entry directories and their contents

This will allow the list to contain locations other than the source
tree.
This commit is contained in:
Brad King 2012-10-04 08:19:45 -04:00
parent 1978075e29
commit c84d7bef82
1 changed files with 9 additions and 9 deletions

View File

@ -80,10 +80,15 @@ list(APPEND gt_src_list
sr_port_cm
sr_port
)
foreach(d ${gt_src_list})
set(source_dir_${d} ${GTM_SOURCE_DIR}/${d})
file(GLOB sources_${d} RELATIVE ${source_dir_${d}}
${d}/*.c ${d}/*.s ${d}/*.si)
endforeach()
set(includes)
foreach(d ${gt_src_list})
list(APPEND includes ${GTM_SOURCE_DIR}/${d})
list(APPEND includes ${source_dir_${d}})
endforeach()
include_directories(${includes})
include_directories(${GTM_BINARY_DIR})
@ -91,7 +96,7 @@ include_directories(${GTM_BINARY_DIR})
function(select_file src_var name)
set(found "")
foreach(d ${gt_src_list})
set(src "${GTM_SOURCE_DIR}/${d}/${name}")
set(src "${source_dir_${d}}/${name}")
if(EXISTS "${src}")
set(found "${src}")
break()
@ -103,11 +108,6 @@ function(select_file src_var name)
set("${src_var}" "${found}" PARENT_SCOPE)
endfunction()
foreach(d ${gt_src_list})
file(GLOB sources_${d} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${d}
${d}/*.c ${d}/*.s ${d}/*.si)
endforeach()
set(sources_used "")
macro(set_source_list target)
foreach(name ${ARGN})
@ -116,7 +116,7 @@ macro(set_source_list target)
if(";${sources_${d}};" MATCHES ";(${name}\\.(c|s|si));")
set(src ${d}/${CMAKE_MATCH_1})
set("source_used_${CMAKE_MATCH_1}" 1)
list(APPEND sources_used ${GTM_SOURCE_DIR}/${src})
list(APPEND sources_used ${source_dir_${d}}/${CMAKE_MATCH_1})
break()
endif()
endforeach()
@ -175,7 +175,7 @@ foreach(d ${gt_src_list})
if(NOT source_used_${s})
list(APPEND libmumps_SOURCES ${d}/${s})
set(source_used_${s} 1)
list(APPEND sources_used ${GTM_SOURCE_DIR}/${d}/${s})
list(APPEND sources_used ${source_dir_${d}}/${s})
endif()
endforeach()
endforeach()