File 0001-Fix-building-without-Ceres.patch of Package openMVS
From b1cf09c74139177fbd0fcb5b033584a93cdbdf02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Wed, 20 Nov 2024 18:49:10 +0100
Subject: [PATCH 1/2] Fix building without Ceres
When `find_package` is run in the subdirectory, the variables
will be altered in the scope of subdirectory, and the
toplevel values are not affected, and ConfigLocal.h will
have incorrect defines.
Remove the additional CERES_INCLUDE_DIRS and CERES_DEFINITIONS,
these are automatically set when adding Ceres to the
`target_link_libraries(MVS ...)`.
---
CMakeLists.txt | 8 +++++++-
libs/MVS/CMakeLists.txt | 12 ------------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 920e4c3..17f3296 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,7 +243,13 @@ if(OpenMVS_USE_SSE)
SET(_USE_SSE TRUE)
endif()
if(OpenMVS_USE_CERES)
- SET(_USE_CERES TRUE)
+ FIND_PACKAGE(Ceres)
+ if(CERES_FOUND)
+ SET(_USE_CERES TRUE)
+ else()
+ set(OpenMVS_USE_CERES OFF)
+ message("-- Can't find CERES. Continuing without it.")
+ endif()
endif()
INCLUDE_DIRECTORIES("${OpenMVS_SOURCE_DIR}")
diff --git a/libs/MVS/CMakeLists.txt b/libs/MVS/CMakeLists.txt
index 8533865..a5e9219 100644
--- a/libs/MVS/CMakeLists.txt
+++ b/libs/MVS/CMakeLists.txt
@@ -12,18 +12,6 @@ if(VCG_FOUND)
add_definitions(${VCG_DEFINITIONS})
endif()
-set(CERES_LIBS "")
-if(OpenMVS_USE_CERES)
- FIND_PACKAGE(Ceres)
- if(CERES_FOUND)
- include_directories(${CERES_INCLUDE_DIRS})
- add_definitions(${CERES_DEFINITIONS})
- else()
- set(OpenMVS_USE_CERES OFF)
- message("-- Can't find CERES. Continuing without it.")
- endif()
-endif()
-
# List sources files
FILE(GLOB LIBRARY_FILES_C "*.cpp")
FILE(GLOB LIBRARY_FILES_H "*.h" "*.inl")
--
2.47.0