View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016099CMakeCMakepublic2016-05-10 10:452016-06-10 14:21
ReporterStefan Zink 
Assigned ToClinton Stimpson 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSKubuntuOS Version16.04 LTS
Product VersionCMake 3.5.2 
Target VersionFixed in Version 
Summary0016099: cmake and cmake-gui don
Description
cmake-gui:
3.5 !> 3.0
3.5 > 3.0
Configuring done

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

TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (186 bytes) 2016-05-10 10:45 [Show Content]

 Relationships

  Notes
(0041040)
Stefan Zink (reporter)
2016-05-10 10:54

It seems as cmake-gui casts to int while the CLI uses floating point arithmetic.
(0041041)
Stefan Zink (reporter)
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 (manager)
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 (manager)
2016-05-10 12:52

Stefan, do you have a locale set in your environment?
(0041046)
Stefan Zink (reporter)
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 (manager)
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 (manager)
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 (developer)
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 (manager)
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 (administrator)
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.

 Issue History
Date Modified Username Field Change
2016-05-10 10:45 Stefan Zink New Issue
2016-05-10 10:45 Stefan Zink File Added: CMakeLists.txt
2016-05-10 10:54 Stefan Zink Note Added: 0041040
2016-05-10 11:02 Stefan Zink Note Added: 0041041
2016-05-10 11:52 Brad King Note Added: 0041042
2016-05-10 12:52 Brad King Note Added: 0041043
2016-05-11 03:32 Stefan Zink Note Added: 0041046
2016-05-11 09:06 Brad King Note Added: 0041049
2016-05-11 09:06 Brad King Assigned To => Clinton Stimpson
2016-05-11 09:06 Brad King Status new => assigned
2016-05-11 09:08 Brad King Note Added: 0041050
2016-05-11 14:53 Clinton Stimpson Note Added: 0041054
2016-05-11 14:53 Clinton Stimpson Status assigned => resolved
2016-05-11 14:53 Clinton Stimpson Resolution open => fixed
2016-05-12 09:27 Brad King Note Added: 0041059
2016-06-10 14:21 Kitware Robot Note Added: 0041174
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team