Refactor m and mpt file copy loops

This commit is contained in:
Brad King 2012-06-18 09:20:30 -04:00
parent ee099a029d
commit ddce370da8
1 changed files with 39 additions and 59 deletions

View File

@ -381,8 +381,8 @@ install(TARGETS
install(TARGETS gtmsecshr_real DESTINATION ${GTM_INSTALL_DIR}/gtmsecshrdir) install(TARGETS gtmsecshr_real DESTINATION ${GTM_INSTALL_DIR}/gtmsecshrdir)
# <r>.m -> <R>.m # <r>.m -> <R>.m
#file(GLOB m_files_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.m) #file(GLOB m_files_sr_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.m)
set(m_files_port set(m_files_sr_port
gde.m gde.m
gdeadd.m gdeadd.m
gdechang.m gdechang.m
@ -403,65 +403,45 @@ set(m_files_port
gdespawn.m gdespawn.m
gdetempl.m gdetempl.m
) )
file(GLOB m_files_sr_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.m)
file(GLOB mpt_files_sr_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.mpt)
file(GLOB mpt_files_sr_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.mpt)
foreach(m ${m_files_port}) foreach(d sr_port sr_unix)
string(TOUPPER "${m}" m_upper) foreach(m ${m_files_${d}})
string(REGEX REPLACE "M$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") get_filename_component(m_name "${m}" NAME_WE)
add_custom_command( string(TOUPPER "${m_name}" m_upper)
OUTPUT "${m_out}" if("${m}" MATCHES "^gde")
DEPENDS ${GTM_SOURCE_DIR}/sr_port/${m} set(m_out "${GTM_BINARY_DIR}${gtm_chset_dir_${gtm_chset}}/${m_upper}.m")
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_port/${m} "${m_out}" add_custom_command(
) OUTPUT "${m_out}"
list(APPEND files_to_place "${m_out}") DEPENDS ${GTM_SOURCE_DIR}/${d}/${m}
if("${m}" MATCHES "^gde") COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/${d}/${m} "${m_out}"
list(APPEND gde_routines "${m_out}") )
else() list(APPEND files_to_place "${m_out}")
list(APPEND gde_routines "${m_out}")
else()
set(m_out "${GTM_BINARY_DIR}/${m_upper}.m")
add_custom_command(
OUTPUT "${m_out}"
DEPENDS ${GTM_SOURCE_DIR}/${d}/${m}
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/${d}/${m} "${m_out}"
)
install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR})
list(APPEND files_to_place "${m_out}")
endif()
endforeach()
foreach(m ${mpt_files_${d}})
string(TOUPPER "_${m}" m_upper)
string(REGEX REPLACE "MPT$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}")
add_custom_command(
OUTPUT "${m_out}"
DEPENDS ${GTM_SOURCE_DIR}/${d}/${m}
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/${d}/${m} "${m_out}"
)
install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR}) install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR})
endif() list(APPEND files_to_place "${m_out}")
endforeach() endforeach()
file(GLOB m_files_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.m)
foreach(m ${m_files_unix})
string(TOUPPER "${m}" m_upper)
string(REGEX REPLACE "M$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}")
add_custom_command(
OUTPUT "${m_out}"
DEPENDS ${GTM_SOURCE_DIR}/sr_unix/${m}
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_unix/${m} "${m_out}"
)
list(APPEND files_to_place "${m_out}")
if("${m}" MATCHES "^gde")
list(APPEND gde_routines "${m_out}")
else()
install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR})
endif()
endforeach()
# <r>.mpt -> _<R>.m
file(GLOB mpt_files_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.mpt)
foreach(m ${mpt_files_port})
string(TOUPPER "_${m}" m_upper)
string(REGEX REPLACE "MPT$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}")
add_custom_command(
OUTPUT "${m_out}"
DEPENDS ${GTM_SOURCE_DIR}/sr_port/${m}
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_port/${m} "${m_out}"
)
install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR})
list(APPEND files_to_place "${m_out}")
endforeach()
file(GLOB mpt_files_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.mpt)
foreach(m ${mpt_files_unix})
string(TOUPPER "_${m}" m_upper)
string(REGEX REPLACE "MPT$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}")
add_custom_command(
OUTPUT "${m_out}"
DEPENDS ${GTM_SOURCE_DIR}/sr_unix/${m}
COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_unix/${m} "${m_out}"
)
install(FILES "${m_out}" DESTINATION ${GTM_INSTALL_DIR})
list(APPEND files_to_place "${m_out}")
endforeach() endforeach()
set(files) set(files)