Commit c59d810
Add CMake option to prefer static deps rather than dynamic deps
Summary:
We would like to build a version of torchcomms that has minimal dependencies on dynamic libraries. I saw that there is an option `USE_STATIC_DEPS_ON_UNIX` introduced in D17228181. However, currently when we enable `USE_STATIC_DEPS_ON_UNIX=ON` to build folly, it will fail by
```
-- Could NOT find LIBUNWIND (missing: LIBUNWIND_LIBRARY)
CMake Error at build/fbcode_builder/CMake/FindLibEvent.cmake:68 (message):
Could NOT find libevent.
Call Stack (most recent call first):
CMake/folly-deps.cmake:73 (find_package)
CMakeLists.txt:145 (include)
-- Configuring incomplete, errors occurred!
```
That is because we only set ".a" to `CMAKE_FIND_LIBRARY_SUFFIXES` and there exists a special library libunwind that does not provide static linking library.
To set `CMAKE_FIND_LIBRARY_SUFFIXES = ".a" ".so"`, we can let cmake first look for `libname.a` and then `libname.so` if `.a` is not found.
Reviewed By: d4l3k
Differential Revision: D81062853
fbshipit-source-id: ce901b03473c82032c75742302ee3ed875d6af491 parent 1c1bb16 commit c59d810
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
15 | 27 | | |
0 commit comments