sapling/CMakeLists.txt
Zeyi (Rice) Fan 89c898a13e fb-mercurial-rust: make CMake build fetch vendored tp2 first
Summary: We do not have network access in Sandcastle but Mercurial needs some external crates to build. So we download the tp2 crates io tar from LFS and set up cargo to be able to find external crates from it.

Reviewed By: wez

Differential Revision: D17407962

fbshipit-source-id: 4fe6be42d52c79340b33687d13723fcbcd63754e
2019-09-26 15:50:52 -07:00

44 lines
1013 B
CMake

cmake_minimum_required(VERSION 3.7)
# CMake include directories
set(
CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
"${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
${CMAKE_MODULE_PATH}
)
set(CMAKE_INSTALL_DIR lib/cmake/mercurial)
# Find dependencies
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(Gflags MODULE REQUIRED)
find_package(folly CONFIG REQUIRED)
find_package(Python COMPONENTS Interpreter)
include(RustStaticLibrary)
include(CMakePackageConfigHelpers)
add_subdirectory(lib)
# install module & CMake configs
install(
EXPORT mercurial
NAMESPACE Mercurial::
FILE mercurial-targets.cmake
DESTINATION "${CMAKE_INSTALL_DIR}"
)
configure_package_config_file(
CMake/mercurial-config.cmake.in
mercurial-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}
PATH_VARS
CMAKE_INSTALL_DIR
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/mercurial-config.cmake
DESTINATION ${CMAKE_INSTALL_DIR}
)