I have a cmake project where I’m using vcpkg as a package manager. One of the dependencies I need is the apriltag dependency which is dependent on the pthread dependency.
the project seems to configure and download the dependencies perfectly fine. Here is a copy of the cmake output for the configuration:
https://drive.google.com/file/d/12G5uv961qeyBKJxFHSum0nsozbCDc4R8/view?usp=sharing
but when I try to build the project, I get many errors, which can be viewed here:
https://drive.google.com/file/d/1vbU6LfpeoIcY0F1X_WHGGM4BKno3Rths/view?usp=sharing
I am currently developing on windows 10:
gcc (Rev3, Built by MSYS2 project) 13.2.0
cmake version 3.30.0-rc4
vcpkg package management program version 2024-07-10-d2dfc73769081bdd9b782d08d27794780b7a99b9
this is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.10)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
project(WPIcal)
set(OSBitness 64)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(OSBitness 32)
endif()
set(FullOutputDir "${CMAKE_SOURCE_DIR}/bin/${CMAKE_SYSTEM_NAME}${OSBitness}/${CMAKE_BUILD_TYPE}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${FullOutputDir}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${FullOutputDir}")
find_package(OpenCV CONFIG REQUIRED)
find_package(apriltag CONFIG REQUIRED)
find_package(ceres CONFIG REQUIRED)
find_package(Eigen3 CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
add_executable(
${PROJECT_NAME}
src/cpp/main.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src/include
${CMAKE_SOURCE_DIR}/wpigui/src/include
)
target_link_libraries(${PROJECT_NAME} PRIVATE
opencv_core
opencv_imgproc
opencv_highgui
opencv_video
opencv_videoio
Ceres::ceres
Eigen3::Eigen
nlohmann_json::nlohmann_json
apriltag::apriltag
)
this is my vcpkg.json file:
{
"dependencies": [
"apriltag",
{
"name": "ceres",
"features": [
"eigensparse"
]
},
{
"name": "opencv4",
"features": [
"ffmpeg",
"contrib"
]
},
"eigen3",
"nlohmann-json",
"glfw3",
"imgui"
]
}
and this is my file structure:
wpical
├── CMakeLists.txt
├── error.txt
├── src
│ ├── cpp
│ │ ├── cameracalibration.cpp
│ │ ├── fieldcalibration.cpp
│ │ └── main.cpp
│ └── include
│ ├── cameracalibration.h
│ └── fieldcalibration.h
├── vcpkg.json
└── wpigui
└── src
├── cpp
│ ├── portable-file-dialogs.cpp
│ ├── wpigui.cpp
│ ├── wpigui_directx11.cpp
│ ├── wpigui_metal.mm
│ ├── wpigui_opengl2.cpp
│ ├── wpigui_opengl3.cpp
│ └── wpigui_openurl.cpp
└── include
├── portable-file-dialogs.h
├── wpigui.h
├── wpigui_internal.h
└── wpigui_openurl.h
So far, I’ve updated msys2, vcpkg, and cmake, but the error still persists.
The really weird thing is that this project builds perfectly fine in a gradle environment, with no build errors about conflicting declarations.
I appreciate any insight on the issue, thanks so much!
Elliot Scher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.