conan의 grpc를 라이브러리를 cmake를 사용하여 빌드하는 과정에서 아래와 같은 에러를 만났다.
CMake Error at CMakeLists.txt:30 (find_package):
By not providing "FindgRPC.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "gRPC", but
CMake did not find one.
Could not find a package configuration file provided by "gRPC" with any of
the following names:
gRPCConfig.cmake
grpc-config.cmake
Add the installation prefix of "gRPC" to CMAKE_PREFIX_PATH or set
"gRPC_DIR" to a directory containing one of the above files. If "gRPC"
provides a separate development package or SDK, be sure it has been
installed.
위 에러문구가 나온 이유는 find_package(gRPC REQUIRED)에서 CMAKE_MODULE_PATH로부터 gRPC모듈을 찾지못하여 발생한 에러이다.
현재 디렉토리 구성은 아래와 같이 "cmake-build-debug" 안에 FindgRPC.cmake가 생성되어 있다.
.
├── basic_grpc_test.cpp
├── cmake-build-debug
│ ├── bin
│ ├── build_all.sh
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ ├── cmake_install.cmake
│ ├── conanbuildinfo.cmake
│ ├── conanbuildinfo.txt
│ ├── conaninfo.txt
│ ├── conan.lock
│ ├── Findabsl.cmake
│ ├── Findc-ares.cmake
│ ├── FindgRPC.cmake
│ ├── FindOpenSSL.cmake
│ ├── FindProtobuf.cmake
│ ├── Findre2.cmake
│ ├── FindZLIB.cmake
│ ├── generated
│ ├── googelTestExercise.cbp
│ ├── graph_info.json
│ ├── lib
│ ├── Makefile
│ ├── Testing
│ └── third_party
├── CMakeLists.txt
├── conanfile.txt
이러한 디렉토리 구성으로 "cmake-build-debug" 디렉토리 안에서 모듈을 검색할 수 있도록 "CMAKE_MODULE_PATH"에 "cmake-build-debug(Binary_directory)"를 추가하여야 한다.
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})