CMake - linking to library downloaded from ExternalProject_add()

前端 未结 6 1596
刺人心
刺人心 2020-11-29 19:34

I am trying to use ExternalProject_add() to download/install dependencies. It installs fine, but I can\'t figure out how to actually link the libraries after they are downlo

6条回答
  •  离开以前
    2020-11-29 20:21

    Another idiom you can use to solve this problem:

    1. Make your find_package commands optional (remove 'REQUIRED')
    2. Add some condition code to only build your targets if find_package succeeds.
    3. find_package will fail and your targets won't be built the first time around, but the External Projects will be built.
    4. Run cmake/make again, this time find_package will succeed and your targets will be built.

    You can see this idiom in action in https://github.com/biometrics/likely.

提交回复
热议问题