MantisBT - CMake
View Issue Details
0015664CMakeCMakepublic2015-07-26 13:212016-05-02 08:30
jcook 
Chuck Atkins 
normalminoralways
closedfixed 
CMake 3.2.3 
CMake 3.4CMake 3.4 
0015664: CMake detects the wrong version for the C and C++ Cray Compiler
This is because CMake is using the _RELEASE macro instead of _RELEASE_MAJOR in Modules/Compiler/Cray-DetermineCompiler.cmake.
cmake --system-information | grep CMAKE_C_COMPILER_VERSION
None at this time. Please let me know if you need more info.
No tags attached.
related to 0015845closed Brad King CMake fails to identify the Cray compilers' version numbers 
c version.c (601) 2015-07-28 12:45
https://public.kitware.com/Bug/file/5490/version.c
txt CMakeLists.txt (95) 2015-07-28 12:45
https://public.kitware.com/Bug/file/5491/CMakeLists.txt
Issue History
2015-07-26 13:21jcookNew Issue
2015-07-27 10:44Chuck AtkinsNote Added: 0039170
2015-07-27 10:48Brad KingTarget Version => CMake 3.4
2015-07-28 12:41jcookNote Added: 0039178
2015-07-28 12:44jcookNote Added: 0039179
2015-07-28 12:45jcookFile Added: version.c
2015-07-28 12:45jcookFile Added: CMakeLists.txt
2015-07-28 12:48jcookNote Added: 0039180
2015-07-28 12:48jcookNote Added: 0039181
2015-07-30 11:50Chuck AtkinsAssigned To => Chuck Atkins
2015-07-30 11:50Chuck AtkinsStatusnew => assigned
2015-07-30 11:51Chuck AtkinsStatusassigned => confirmed
2015-07-30 11:52Chuck AtkinsNote Added: 0039199
2015-07-30 11:58Brad KingNote Added: 0039200
2015-07-31 09:16Brad KingStatusconfirmed => resolved
2015-07-31 09:16Brad KingResolutionopen => fixed
2015-07-31 09:16Brad KingFixed in Version => CMake 3.4
2015-11-12 10:30Brad KingRelationship addedrelated to 0015845
2016-05-02 08:30Robert MaynardNote Added: 0040959
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0039170)
Chuck Atkins   
2015-07-27 10:44   
Hi Justin,
Tanks for the bug report! Do you have more details on what does happen versus what *should happen? Also, if you have a patch, that would be great!
(0039178)
jcook   
2015-07-28 12:41   
I have both a patch and a small test case you can use.
(0039179)
jcook   
2015-07-28 12:44   
This is what CMake reports currently:

-- The C compiler identification is Cray 11.3
-- Check for working C compiler: /opt/cray/craype/2.4.0.4/bin/cc
-- Check for working C compiler: /opt/cray/craype/2.4.0.4/bin/cc -- works

The problem is that the version should actually be 8.3, instead of 11.3. The _RELEASE macro is set to +3 of what the release actually is. It had a historical purpose at one time if I recall.

Instead, you should use _RELEASE_MAJOR for this.
(0039180)
jcook   
2015-07-28 12:48   
I uploaded two files with which you can recreate the problem.

Here is the cmake output:

-- The C compiler identification is Cray 11.3
-- Check for working C compiler: /opt/cray/craype/2.4.0.4/bin/cc
-- Check for working C compiler: /opt/cray/craype/2.4.0.4/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: ...

Here is the program output:

_CRAYC: 1
_RELEASE_MAJOR: 8
_RELEASE_MINOR: 3
_RELEASE_STRING: Cray C++ : Version 8.3.14.102 (u83061c83132)

These macros are described on Cray's documentation website in the C/C++ reference manual here:

http://docs.cray.com/cgi-bin/craydoc.cgi?mode=View;id=S-2179-83;idx=books_search;this_sort=title;q=;type=books;title=Cray%20C%20and%20C%2b%2b%20Reference%20Manual [^]

Let me know if you have trouble getting to the URL.
(0039181)
jcook   
2015-07-28 12:48   
Here is a git diff of what I think the fix should be, but perhaps there's things I'm missing:

diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake
index 881b82c..6602294 100644
--- a/Modules/Compiler/Cray-DetermineCompiler.cmake
+++ b/Modules/Compiler/Cray-DetermineCompiler.cmake
@@ -2,5 +2,5 @@
 set(_compiler_id_pp_test "defined(_CRAYC)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE_MAJOR)
 # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)")
(0039199)
Chuck Atkins   
2015-07-30 11:52   
Patch pushed to stage/fix-cray-version and merged to next for testing.
(0039200)
Brad King   
2015-07-30 11:58   
For reference, the commit is here:

 Cray: Fix compiler version detection
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22809b16 [^]
(0040959)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.