CMake: adding custom resources to build directory

前端 未结 2 679
情话喂你
情话喂你 2021-02-18 21:53

I am making a small program which requires an image file foo.bmp to run
so i can compile the program but to run it, i have to copy foo.bmp to \'build\' subdirectory manually

2条回答
  •  忘掉有多难
    2021-02-18 22:51

    In case of this might help, I tried another solution using file command. There is the option COPY that simply copy a file or directory from source to dest.

    Like this: FILE(COPY yourImg.png DESTINATION "${CMAKE_BINARY_DIR}")

    Relative path also works for destination (You can simply use . for instance)

    Doc reference: https://cmake.org/cmake/help/v3.0/command/file.html

提交回复
热议问题