0

HI I'm beginning to use cmake, And I like it a lot, I was wondering if there was a command to add an existing folder that contain input file in the build process.

Desired structure

project/
   src/
   ressources/someinputData

I don't want to copy all the files on resources to the build folder.

Konrad Rudolph
  • 506,650
  • 124
  • 909
  • 1,183
  • 1
    What do you mean by "add in the build process"? Are you files involved in the build process (if yes, how?) or do you want them installed with your targets? – rgmt Aug 02 '16 at 14:29
  • Non there are non compiled file,Just some input data to test my program. – anass belcaid Aug 02 '16 at 14:45

1 Answers1

1

You can use the command install to copy your files when using make install or building the INSTALL project in visual, according to your prefered tool:

install(
    FILES /path/to/your/file.s
    DESTINATION /where/you/want/to/copy
)

There is also this version to install a whole directory, eventually filtering file extensions:

install(
    DIRECTORY /path/to/your/directory/
    DESTINATION /where/you/want/to/copy
    FILES_MATCHING
    PATTERN *.txt  # only copy text files
)
rgmt
  • 14,120
  • 12
  • 47
  • 66
  • Overkilled solution since I'm just trying to copy (or just link) them in the build folder. But I'll try this solution. Thank you – anass belcaid Aug 02 '16 at 14:57
  • Feel free to edit your question with a more concrete example for something less overkilled ;) – rgmt Aug 02 '16 at 15:01
  • the is method did solve my problem. Thank you – anass belcaid Aug 02 '16 at 15:17
  • The file command is probably what you want. file( .. See the docs here: https://cmake.org/cmake/help/v3.0/command/file.html – StAlphonzo Aug 02 '16 at 19:09
  • Hi, Thank you , I think this is the preferable solution, I use file command with GLOB to generate the sources files, but I didn't expected to be more general. Thank you – anass belcaid Aug 04 '16 at 15:51