facebook/proxygen

Using proxygen in CMake project cause `add_library cannot create imported target "sodium" error`.

alishir opened this issue · 3 comments

I installed proxygen and all the required dependencies. I created simple CMake project and tried to use proxygen. Also I added FindSodium.cmake from fizz project. But I got following error during makeing the project:

sample_project/_build$ cmake ..

-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.51.0") found components: context filesystem program_options regex system thread
-- Found folly: /usr/local
-- Found wangle: /usr/local
-- Found fizz: /usr/local
-- Found folly: /usr/local
CMake Error at cmake/FindSodium.cmake:257 (add_library):
  add_library cannot create imported target "sodium" because another target
  with the same name already exists.
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/fizz/fizz-config.cmake:52 (find_dependency)
  /usr/share/cmake-3.18/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/mvfst/mvfst-config.cmake:45 (find_dependency)
  /usr/share/cmake-3.18/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/proxygen/proxygen-config.cmake:48 (find_dependency)
  CMakeLists.txt:14 (find_package)

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)

project(sample_project)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_MODULE_PATH
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
  "/usr/local/lib/cmake/proxygen"
  )

find_package(proxygen REQUIRED)

add_subdirectory(server)

It seems the issue is from proxygen-config.cmake that is installed in /usr/local/lib/cmake/proxygen. In line 45 and 47 it finds folly and fizz, also similar dependencies are found in mvfst-config.cmake and cause this problem.

I think we could comment the find_dependency(folly) and find_dependency(fizz) in proxygen-config.cmake because these dependencies are looked up in mvfst-config.cmake.

Why was this closed? This is still broken.

Would be fixed by #367