facebook / facebook/folly

Installing with cmake

Open
#2,165 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

Having a lot of trouble installing this project into an existing cmake project.
There is a decent chance that this is just a lack of CMake knowledge on my end, but I do believe the install instructions are quite difficult for beginners.
Happy to help write a installation guide for beginners like me (if you think it's useful) if someone could help point me in the right direction.
OS: Ubuntu 22.04.4 LTS

Wrote a shell script to do the building for me, to make my issues reproducible.
```sh
mv install /tmp
cd folly
git checkout main
git pull
mkdir -p install
sudo ./build/fbcode_builder/getdeps.py install-system-deps --recursive
python3 ./build/fbcode_builder/getdeps.py --allow-system-packages build
# python3 ./build/fbcode_builder/getdeps.py --allow-system-packages test
FOLLY_PATH=$(python3 ./build/fbcode_builder/getdeps.py show-build-dir)
cp -r $FOLLY_PATH/../../installed/ ../install

cd ..
mv install/fmt*/ install/fmt
mv install/googletest* install/googletest
```

Put this in the cmake to try and put it together.
```CMake
find_package(Gflags CONFIG REQUIRED)

set_target_properties(gflags_shared PROPERTIES
MAP_IMPORTED_CONFIG_DEBUG Release
)
find_package(folly REQUIRED)
set_and_check(FOLLY_INCLUDE_DIR /home/thetazero/research/new_stuff/run_all_benchmarks/install/folly/include)
set_and_check(FOLLY_INCLUDE_DIR /home/thetazero/research/new_stuff/run_all_benchmarks/install/folly/lib/cmake/folly)
if (NOT TARGET Folly::folly)
include("${FOLLY_CMAKE_DIR}/folly-targets.cmake")
endif()

set(FOLLY_LIBRARIES Folly::folly)

if (NOT folly_FIND_QUIETLY)
message(STATUS "Found folly: ${PACKAGE_PREFIX_DIR}")
endif()
target_link_libraries(cdrc INTERFACE ${FOLLY_LIBRARIES})
```

Getting the following error (yes the directories are correct/exist I triple checked)
```
CMake Error at CMakeLists.txt:136 (find_package):
By not providing "Findfolly.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "folly", but
CMake did not find one.

Could not find a package configuration file provided by "folly" with any of
the following names:

follyConfig.cmake
folly-config.cmake

Add the installation prefix of "folly" to CMAKE_PREFIX_PATH or set
"folly_DIR" to a directory containing one of the above files. If "folly"
provides a separate development package or SDK, be sure it has been
installed.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.