MantisBT - CMake
View Issue Details
0004090CMakeCMakepublic2006-11-29 13:532007-02-21 10:52
Didier Link 
Bill Hoffman 
normalmajoralways
closedfixed 
 
 
0004090: mistake in CMAKE_SYSTEM_PROCESSOR definition ?
Hi,

I work on a gentoo linux amd64 and look at some strange results of a project configuration by cmake.

The project assume to find the architecture of the processor (like x86_64 or powerpc etc etc) in the CMAKE_SYSTEM_PROCESSOR variable to add some specific flags during compilation. In my case they need to have -fPIC.

Now the variable contain the result of uname -p and it is "AMD Athlon(tm) 64 X2 Dual Core Processor 4200+" !? Not very usefull bacause of the variety of processor names ... the uname -m command result is "x86_64" and that's what I need.

I think it's a mistake in the file cmake-2.4.4/Modules/CMakeDetermineSystem.cmake that use uname -p in place of uname -m.

Do you think I'm wrong ?

Thanks to consider this change !
No tags attached.
patch system-linux.patch (1,349) 1969-12-31 19:00
https://public.kitware.com/Bug/file/757/system-linux.patch
Issue History

Notes
(0005828)
Bill Hoffman   
2006-11-29 15:09   
I think the problem is that some machines (commerical unix) do not support -m. So the code actually does this:
 
   EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
      RETURN_VALUE val)
# if the uname -p failed with an error try -m
    IF("${val}" GREATER 0)
      EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
        RETURN_VALUE val)
    ENDIF("${val}" GREATER 0)

For example on an IRIX machine I get this:
laserX 1% uname -p
mips
laserX 2% uname -m
IP35

The -p is better....
(0005829)
Didier Link   
2006-11-29 16:43   

Yes the -p is better for IRIX but in the posix specs this option doesn't exist !?

Maybe it's necessary to add a test case for use the -m option with posix compliant uname (like the GNU one, present on a lot of hardware ... see debian hardware compatibility for example).

What do you think about this point ?
(0005832)
Bill Hoffman   
2006-11-29 20:32   
http://www.tu-berlin.de/zrz/dienste/www/manpages/uname.html [^]
seems to say -p is POSIX. but http://www.opengroup.org/onlinepubs/009695399/utilities/uname.html [^]
seems to leave out -p....
So, I am not sure what to do.... The IRIX has both, many linux systems do not have -p so it defaults to -m.
(0005847)
Didier Link   
2006-12-01 03:02   
For the FreeBSD uname's command, it's the same behaviour of the Linux ones. The -p option "just" send the "commercial name" of the processor ...

I send you a patch for experiment my idea on Linux. Maybe a more in-depth work need to be done for include more unixes flavour in the test case ...

(0006505)
Bill Hoffman   
2007-02-21 10:52   
I have applied the patch