@@ -121,14 +121,20 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
121
121
ocv_cmake_hook(PRE_CMAKE_BOOTSTRAP)
122
122
123
123
# Bootstrap CMake system: setup CMAKE_SYSTEM_NAME and other vars
124
+
125
+ # workaround: https://gitlab.kitware.com/cmake/cmake/-/issues/20989
124
126
if (OPENCV_WORKAROUND_CMAKE_20989)
125
127
set (CMAKE_SYSTEM_PROCESSOR_BACKUP ${CMAKE_SYSTEM_PROCESSOR} )
126
128
endif ()
127
- enable_language (CXX C)
129
+
130
+ project (OpenCV CXX C)
131
+
128
132
if (OPENCV_WORKAROUND_CMAKE_20989)
129
133
set (CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_BACKUP} )
130
134
endif ()
131
135
136
+ enable_testing ()
137
+
132
138
ocv_cmake_hook(POST_CMAKE_BOOTSTRAP)
133
139
134
140
if (NOT OPENCV_SKIP_CMAKE_SYSTEM_FILE)
@@ -151,10 +157,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # https://cmake.org/cmake/help/
151
157
endif ()
152
158
endif ()
153
159
154
- enable_testing ()
155
-
156
- project (OpenCV CXX C)
157
-
158
160
if (MSVC )
159
161
set (CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
160
162
endif ()
@@ -163,70 +165,30 @@ ocv_cmake_eval(DEBUG_PRE ONCE)
163
165
164
166
ocv_clear_vars(OpenCVModules_TARGETS)
165
167
166
- include (cmake/OpenCVDownload.cmake)
167
-
168
- set (BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')" )
169
-
170
168
# ----------------------------------------------------------------------------
171
- # Break in case of popular CMake configuration mistakes
169
+ # Autodetect if we are in a GIT repository
172
170
# ----------------------------------------------------------------------------
173
- if (NOT CMAKE_SIZEOF_VOID_P GREATER 0)
174
- message (FATAL_ERROR "CMake fails to determine the bitness of the target platform.
175
- Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details." )
171
+ find_host_package(Git QUIET )
172
+
173
+ if (NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
174
+ ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR} " )
175
+ elseif (NOT DEFINED OPENCV_VCSVERSION)
176
+ # We don't have git:
177
+ set (OPENCV_VCSVERSION "unknown" )
176
178
endif ()
177
179
180
+ include (cmake/OpenCVDownload.cmake)
181
+
178
182
# ----------------------------------------------------------------------------
179
183
# Detect compiler and target platform architecture
180
184
# ----------------------------------------------------------------------------
181
185
include (cmake/OpenCVDetectCXXCompiler.cmake)
182
186
ocv_cmake_hook(POST_DETECT_COMPILER)
183
187
184
- # Add these standard paths to the search paths for FIND_LIBRARY
185
- # to find libraries from these locations first
186
- if (UNIX AND NOT ANDROID)
187
- if (X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
188
- if (EXISTS /lib64)
189
- list (APPEND CMAKE_LIBRARY_PATH /lib64)
190
- else ()
191
- list (APPEND CMAKE_LIBRARY_PATH /lib)
192
- endif ()
193
- if (EXISTS /usr/lib64)
194
- list (APPEND CMAKE_LIBRARY_PATH /usr/lib64)
195
- else ()
196
- list (APPEND CMAKE_LIBRARY_PATH /usr/lib)
197
- endif ()
198
- elseif (X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
199
- if (EXISTS /lib32)
200
- list (APPEND CMAKE_LIBRARY_PATH /lib32)
201
- else ()
202
- list (APPEND CMAKE_LIBRARY_PATH /lib)
203
- endif ()
204
- if (EXISTS /usr/lib32)
205
- list (APPEND CMAKE_LIBRARY_PATH /usr/lib32)
206
- else ()
207
- list (APPEND CMAKE_LIBRARY_PATH /usr/lib)
208
- endif ()
209
- endif ()
210
- endif ()
211
-
212
- # Add these standard paths to the search paths for FIND_PATH
213
- # to find include files from these locations first
214
- if (MINGW)
215
- if (EXISTS /mingw)
216
- list (APPEND CMAKE_INCLUDE_PATH /mingw)
217
- endif ()
218
- if (EXISTS /mingw32)
219
- list (APPEND CMAKE_INCLUDE_PATH /mingw32)
220
- endif ()
221
- if (EXISTS /mingw64)
222
- list (APPEND CMAKE_INCLUDE_PATH /mingw64)
223
- endif ()
224
- endif ()
225
-
226
188
# ----------------------------------------------------------------------------
227
189
# OpenCV cmake options
228
190
# ----------------------------------------------------------------------------
229
-
191
+ set (BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')" )
230
192
OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF )
231
193
232
194
# 3rd party libs
@@ -660,19 +622,6 @@ ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
660
622
# ----------------------------------------------------------------------------
661
623
set (OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV modules (can be ;-separated list of paths)" )
662
624
663
- # ----------------------------------------------------------------------------
664
- # Autodetect if we are in a GIT repository
665
- # ----------------------------------------------------------------------------
666
- find_host_package(Git QUIET )
667
-
668
- if (NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
669
- ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR} " )
670
- elseif (NOT DEFINED OPENCV_VCSVERSION)
671
- # We don't have git:
672
- set (OPENCV_VCSVERSION "unknown" )
673
- endif ()
674
-
675
-
676
625
# ----------------------------------------------------------------------------
677
626
# OpenCV compiler and linker options
678
627
# ----------------------------------------------------------------------------
0 commit comments