cmake script fails to detect clang version when built from svn repository (Bug #2212)
Description
The cmake script of OpenCV 2.4.2 (downloaded from Sourceforge) fails detecting the version of clang, which was built from subversion (thus having a different versioning scheme):
$ clang++ --version
clang version 3.2 (trunk 159898)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" path/to/OpenCV
...
-- The CXX compiler identification is Clang
-- The C compiler identification is Clang
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:76 (list):
list index: 1 out of range (-1, 0)
Call Stack (most recent call first):
CMakeLists.txt:76 (include)
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:79 (math):
math cannot parse the expression: "159898*100 + ": syntax error, unexpected
$end, expecting exp_OPENPARENT or exp_NUMBER (13)
Call Stack (most recent call first):
CMakeLists.txt:76 (include)
-- Detected version of GNU GCC: 159898 ()
Associated revisions
Merge pull request #2212 from SpecLad:hog-sample-const-mat
History
Updated by Christian Maaser over 12 years ago
I just realized that the error is in cmake/OpenCVDetectCXXCompiler.cmake:67: The regular expression to fetch the compiler's version "[0-9]+.[0-9]+.[0-9]+" needs to escape both dot characters: "[0-9]+\\.[0-9]+\\.[0-9]+".
Same goes for the regex directly below in line 69: "[0-9]+.[0-9]+" needs to be changed to "[0-9]+\\.[0-9]+"
Updated by Marina Kolpakova over 12 years ago
Thinks! fixed in 22673c16
- Status changed from Open to Done
- Target version set to 2.4.3
- Assignee changed from Alexander Shishkov to Marina Kolpakova