Skip to content

Commit

Permalink
Fix nasa#790, allow directories and symlinks in FILELIST.
Browse files Browse the repository at this point in the history
Checks a name-based subdirectory under ${MISSION_DEFS} for
files listed in the FILELIST for that target.

If file is a symlink, the link should be followed so the correct
content is installed, not a symlink.
  • Loading branch information
jphickey committed Feb 5, 2021
1 parent 4374482 commit 51a614c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,19 @@ function(process_arch SYSVAR)
add_subdirectory(cmake/target ${TGTNAME})

foreach(INSTFILE ${${TGTNAME}_FILELIST})
if(EXISTS ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
if(EXISTS ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
elseif(EXISTS ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
elseif(EXISTS ${MISSION_DEFS}/${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${INSTFILE})
else()
set(FILESRC)
endif()
if (FILESRC)
# In case the file is a symlink, follow it to get to the actual file
get_filename_component(FILESRC "${FILESRC}" REALPATH)
message("NOTE: Selected ${FILESRC} as source for ${INSTFILE} on ${TGTNAME}")
install(FILES ${FILESRC} DESTINATION ${TGTNAME}/${INSTALL_SUBDIR} RENAME ${INSTFILE})
else(FILESRC)
message("WARNING: Install file ${INSTFILE} for ${TGTNAME} not found")
Expand Down

0 comments on commit 51a614c

Please sign in to comment.