CMake install is not installing libraries on Windows

前端 未结 1 1539
醉梦人生
醉梦人生 2020-12-20 22:08

For some reason, the below CMake file fails to install the project libraries. It creates the directory in the right location, and it even recursively installs the headers...

相关标签:
1条回答
  • 2020-12-20 23:02

    You're just missing the RUNTIME DESTINATION argument in the install(TARGETS...) command.

    CMake treats shared libraries as runtime objects on "DLL platforms" like Windows. If you change your command to:

    install(TARGETS MyLib LIBRARY DESTINATION "lib"
                          ARCHIVE DESTINATION "lib"
                          RUNTIME DESTINATION "bin"
                          COMPONENT library)
    

    then you should find that MyLib.dll ends up in "devel_artifacts/bin".

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