trinity-users@lists.pearsoncomputing.net

Message: previous - next
Month: February 2011

Re: [trinity-users] Built gcc 4.3.4-3 -- howto change Trinity cmake files to use gcc 4.3.4 instead of gcc 4.5.2

From: "David C. Rankin" <drankinatty@...>
Date: Sun, 13 Feb 2011 21:33:46 -0600
On 02/13/2011 09:18 PM, David C. Rankin wrote:
> Tim, all,
> 
>   I have built gcc 4.3.4-3 to see if that fixes the iccconfig.cpp build failure
> in kdebase. What I don't know is:
> 
> "How to I change the cmake call or CMakeLists.txt to make sure I'm using gcc 4.3
> and not 5.4?"
> 
>   The executable is '/usr/bin/gcc-4.3'. Do I need a CC=gcc-4.3 or CXX=gcc-4.3
> somewhere? If so where?
> 
>   I've never tried to build anything with alternate gcc's installed. Any help
> would be greatly appreciated.
> 
> 

I think I have found what to set, I just don't know *where* to set it in kdebase
(or the rest of the trinity modules). From
http://www.cmake.org/Wiki/CMake_Useful_Variables it looks like I need to set:

CMAKE_C_COMPILER
    the compiler used for C files. Normally it is detected and set during the
CMake run, but you can override it at configuration time. Note! It can not be
changed after the first cmake or ccmake run. Although the gui allows to enter an
alternative, it will be ignored in the next 'configure' run. Use for example:
    CC=gcc-3.3 CXX=g++-3.3 cmake
    to set the compiler. (You can also set CMAKE_C_COMPILER_INIT, before any
PROJECT() or ENABLE_LANGUAGE() command.) Any other way (like writing make
CC=gcc-3.3 CXX=g++-3.3) will not work. When using distcc or similar tools, you
need to write:
    CC="distcc gcc-3.3" CXX="distcc g++-3.3" cmake
    However, this will empty all your CMAKE_..._FLAGS_... above

and

CMAKE_CXX_COMPILER
    the compiler used for C++ files. Normally it is detected and set during the
CMake run, but you can override it at configuration time. Note! It can not be
changed after the first cmake or ccmake run. See CMAKE_C_COMPILER above.

  But where? Guessing, I think I can do this is CMakeLists.txt with something
similar to the following:

###### global compiler settings #################

add_definitions(
  -DHAVE_CONFIG_H
  ${TQT_CFLAGS_OTHER}
)

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )

##### dcr cmake flags for gcc-4.3 ###############

set( CMAKE_C_COMPILER "gcc-4.3" )
set( CMAKE_CXX_COMPILER "g++-4.3" )

  I'll see if this will work, but if this isn't right, please let me know what
else to try. Thanks.

-- 
David C. Rankin, J.D.,P.E.