cmake glob include while preserving directory structure

后端 未结 1 971
我寻月下人不归
我寻月下人不归 2021-02-13 03:39

I\'m new to cmake and I\'m trying to install .hpp files while preserving directory structure.

So far I have

FILE(GLOB files \"$         


        
1条回答
  •  深忆病人
    2021-02-13 04:10

    You can use the DIRECTORY variant of the CMake install command. This command will preserve the structure of the copied directory:

    install(DIRECTORY include/ DESTINATION include
              FILES_MATCHING PATTERN "*.hpp")
    

    If the directory to be copied contains subdirectories that should not be installed, you'll have to explicitly exclude those with a PATTERN EXCLUDE option:

    install(DIRECTORY include/ DESTINATION include
              FILES_MATCHING PATTERN "*.hpp"
              PATTERN "include/MyOtherLib" EXCLUDE)
    

    0 讨论(0)
提交回复
热议问题