Reputation: 531
I'm having some issues understand what would be the correct protocol to follow here. Let's say in my use case I have a CMake C++ project with the colmap dependency that itself depends on boost.
- project
- dependencies
- colmap (git submodule)
- boost (git submodule)
- CMakeLists.txt
- src
- ...
- CMakeLists.txt
- CMakeLists.txt
My initial thought was to set the cmake configuration as follows:
# project/CMakeLists.txt
cmake_minimum_required(VERSION 3.29)
project(myproject)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(dependencies)
add_subdirectory(src)
# project/dependencies/CMakeLists.txt
add_subdirectory(boost)
add_subdirectory(colmap)
However, when configuring the project, colmap complains it can not find boost:
CMake Error at C:/Program Files (x86)/.../cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR graph program_options
system)
I thought I could just set the variable Boost_INCLUDE_DIR
to point to the correct directory, but that will make it complain it doesnt find version.hpp
which I believe is part of the boost config lib:
CMake Error at C:/Program Files (x86)/.../cmake-3.29/Modules/FindBoost.cmake:1842 (file):
file STRINGS file
"C:/Users/.../myproject/dependencies/boost/boost/version.hpp"
cannot be read.
As I have read online, both this error and my confusion seem to arise from the point that colmap is using find_package(Boost ${COLMAP_FIND_TYPE} COMPONENTS graph program_options system)
which requires an already compiled and installed version of boost and I'm trying to just use the configuration variables with add_submodule
and these two approaches are not compatible.
The solutions I have came up with are:
find_package
, but this looks "dirty"Are there any other approaches that would be good in this case ?
Upvotes: 2
Views: 84