From c84d7bef82f16f7f080ab9026f355f544fa68b87 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Oct 2012 08:19:45 -0400 Subject: [PATCH] Pre-compute gt_src_list entry directories and their contents This will allow the list to contain locations other than the source tree. --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bb6df5..dd3550b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()