CMAKE add sub-directory which is not sub-directory on real directory

前端 未结 2 1350
花落未央
花落未央 2020-12-13 03:46

Is It possible to include sibling directory as Sub-Directory inside cmake ?

Something like

A 
  CMakeLists.txt

B
  CMakeLists.txt

2条回答
  •  醉酒成梦
    2020-12-13 04:12

    Unfortunately, no.

    As solution i may suggest you to add_subdirectory(A) and add_subdirectory(B) at the top level and set vars you want to export from A with PARENT_SCOPE. This would allow B/CMakeLists.txt to access varibles defined in A/CMakeLists.txt

提交回复
热议问题