MantisBT - CMake
View Issue Details
0016099CMakeCMakepublic2016-05-10 10:452016-06-10 14:21
Stefan Zink 
Clinton Stimpson 
normalmajoralways
closedfixed 
LinuxKubuntu16.04 LTS
CMake 3.5.2 
 
0016099: cmake and cmake-gui don

cmake-gui:
3.5 !> 3.0
3.5 > 3.0
Configuring done

cmake:
3.5 > 3.0
3.5 > 3.0
-- Configuring done

No tags attached.
txt CMakeLists.txt (186) 2016-05-10 10:45
https://public.kitware.com/Bug/file/5689/CMakeLists.txt
Issue History
2016-05-10 10:45Stefan ZinkNew Issue
2016-05-10 10:45Stefan ZinkFile Added: CMakeLists.txt
2016-05-10 10:54Stefan ZinkNote Added: 0041040
2016-05-10 11:02Stefan ZinkNote Added: 0041041
2016-05-10 11:52Brad KingNote Added: 0041042
2016-05-10 12:52Brad KingNote Added: 0041043
2016-05-11 03:32Stefan ZinkNote Added: 0041046
2016-05-11 09:06Brad KingNote Added: 0041049
2016-05-11 09:06Brad KingAssigned To => Clinton Stimpson
2016-05-11 09:06Brad KingStatusnew => assigned
2016-05-11 09:08Brad KingNote Added: 0041050
2016-05-11 14:53Clinton StimpsonNote Added: 0041054
2016-05-11 14:53Clinton StimpsonStatusassigned => resolved
2016-05-11 14:53Clinton StimpsonResolutionopen => fixed
2016-05-12 09:27Brad KingNote Added: 0041059
2016-06-10 14:21Kitware RobotNote Added: 0041174
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0041040)
Stefan Zink   
2016-05-10 10:54   
It seems as cmake-gui casts to int while the CLI uses floating point arithmetic.
(0041041)
Stefan Zink   
2016-05-10 11:02   
Can be reproduced with prebuild cmake 3.5.2 (https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz [^]) and cmake 3.5.1 of the Ubuntu repository.
(0041042)
Brad King   
2016-05-10 11:52   
$ curl -O https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz [^]
$ tar xzf cmake-3.5.2-Linux-x86_64.tar.gz
$ mkdir build
$ cd build
$ cat ../CMakeLists.txt
PROJECT(BUG)

IF("3.5" GREATER "3.0")
  MESSAGE("3.5 > 3.0")
ELSE()
  MESSAGE("3.5 !> 3.0")
ENDIF()

IF("3.5" VERSION_GREATER "3.0")
  MESSAGE("3.5 > 3.0")
ELSE()
  MESSAGE("3.5 !> 3.0")
ENDIF()

$ ../cmake-3.5.2-Linux-x86_64/bin/cmake ..
...
3.5 > 3.0
3.5 > 3.0
...

$ ../cmake-3.5.2-Linux-x86_64/bin/cmake-gui ..
3.5 > 3.0
3.5 > 3.0
Configuring done
(0041043)
Brad King   
2016-05-10 12:52   
Stefan, do you have a locale set in your environment?
(0041046)
Stefan Zink   
2016-05-11 03:32   
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
(0041049)
Brad King   
2016-05-11 09:06   
Re 0016099:0041046: Thanks. The LC_NUMERIC locale is causing cmake-gui to configure the C runtime library locale for number parsing such that "3.5" looks like an integer because the floating point format for the locale would be "3,5". I can reproduce this with:

$ export LC_NUMERIC=de_DE.UTF-8
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

$ ../cmake-3.5.2-Linux-x86_64/bin/cmake-gui ..
3.5 !> 3.0
3.5 > 3.0

However, if I patch CMakeLists.txt like this:

-IF("3.5" GREATER "3.0")
+IF("3,5" GREATER "3,0")

then I get the "expected" comparison result because the floating point format now matches the locale:

$ ../cmake-3.5.2-Linux-x86_64/bin/cmake-gui ..
3.5 > 3.0
3.5 > 3.0
(0041050)
Brad King   
2016-05-11 09:08   
Clinton, please take a look at this. Our use of setlocale only specifies LC_CTYPE so it is not clear how it picks up LC_NUMERIC too. Might Qt be doing something?
(0041054)
Clinton Stimpson   
2016-05-11 14:53   
Yes, Qt does the following at startup.
setlocale(LC_ALL, "");

Since Qt 4.4, they removed a subsequent
setlocale(LC_NUMERIC, "C");


Fixed here:
https://cmake.org/gitweb?p=cmake.git;a=commit;h=97775975 [^]
(0041059)
Brad King   
2016-05-12 09:27   
Re 0016099:0041054: Thanks. I revised the commit message slightly:

 cmake-gui: Always use "C" locale for numbers
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cab095e1 [^]
(0041174)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.