install( FILES ... ) installing all files in directory when single file is specified


I’m using cmake 3.17.0 and then tried 3.17.5. Our cmake code base uses the commands:

message( STATUS “---- ${resolvedFileToInstall} -> ${to_directory}” )
FILES “${resolvedFileToInstall}”
DESTINATION “${to_directory}/”
COMPONENT “${resourcesComponent}”

One such use shows (in the message):

---- D:/Build4/gitAll/gpc/gis/resources/landClassification/IGBPa_1198.dat -> resources/landClassification/

Though only a single file is specified (IGBPa_1198.dat), the contents of the landClassification directory are all copied and placed in the installer. Is this a bug in the install command?


Hi Matthew,

Not an expert by any means, but I wonder if you are confusing your ${resolvedFileToInstall} “landClassification” directory with the target ${to_directory} “landClassification” directory?

I would expect the DESTINATION to be copied to the installer; this command is just adding a single file to that destination. Was it otherwise empty?