[CMake] pg compilers on the Cary XT4

Will Dicharry wdicharry at stellarscience.com
Thu Aug 20 14:03:32 EDT 2009


Responses inline...

I'm reposting this to the CMake mailing list so someone can correct me 
if I'm wrong, it looks like your message went only to me.

John R. Cary wrote:
> Will Dicharry wrote:
>> John R. Cary wrote:
>>> which is basically Linux.
>>>
>>> Building a project with pgcc/pgCC.
>>>
>>>
>>> All flags are empty:
>>>
>>> CMAKE_CXX_COMPILER               
>>> /opt/pgi/8.0.4/linux86-64/8.0-4/bin/pgCC    
>>> CMAKE_CXX_FLAGS                                                               
>>>
>>> CMAKE_CXX_FLAGS_DEBUG                                                         
>>>
>>> CMAKE_CXX_FLAGS_MINSIZEREL                                                    
>>>
>>> CMAKE_CXX_FLAGS_RELEASE                                                       
>>>
>>> CMAKE_CXX_FLAGS_RELWITHDEBINFO
>>> Where should I add these?
>>
>> For the XT4, the CNL backend no longer requires a cross compile. We 
>> had a discussion on the list about this last month, and for setting 
>> the compilers I believe the consensus was to either:
>>
>> 1.  Set them as environment variables.  CMake will check the value of 
>> the environment variables CC, CXX, and FC for the names of the C, C++, 
>> and Fortran compilers respectively.
>>
>> 2. Use cmake -C to
> 
> Thanks, Will.
> 
> I am getting the compiler set using 'CC=pgcc CXX=pgCC' in my environment,
> but then the FLAGS variables are empty.
>>
>>>
>>>
>>> Another question: The default builds seem to be DEBUG,
>>> MINSIZEREL, RELEASE, RELWITHDEBINFO.  Suppose I wanted
>>> to define a new kind of build, e.g., PERFORMANCE.
>>> How can I go about doing this?
>>
>> When using the makefile generator, you can define a new build type by 
>> setting it in the CMAKE_BUILD_TYPE variable and defining language 
>> flags for that type, so you could do something like:
>>
>> set( CMAKE_BUILD_TYPE PERFORMANCE )
>> set( CMAKE_C_FLAGS_PERFORMANCE "-O3" )
>> set( CMAKE_CXX_FLAGS_PERFORMANCE "-O3" )
>>
>> take a look at http://www.cmake.org/Wiki/CMake_Useful_Variables in the 
>> CMAKE_BUILD_TYPE section.
>>
>> Hope this helps, 
> 
> It helps alot!  Perhaps I just need to be directed to some reading 
> material, even though
> I have been googling quite a bit.
> 
> I would like to reuse these flags over many projects, and so I am hoping 
> I can
> put them in a file in my CMake subdir, which is actually an svn 
> external, and be reused
> across multiple projects.
> 
>  From my short experience with CMake, it seems that once one has determined
> an OS/Compiler option, cmake looks for <compiler>.cmake under 
> Modules/Compiler,
> then for <os>-<compiler>.cmake under Modules/Platform, with each able to
> add to or overwrite the previous.
> 
> Is that correct?

I /think/ that is correct, although someone more familiar with CMake's 
startup procedure may be able to correct me.

> 
> If I want to override, then I assume I could add a file 
> <os>-<compiler>.cmake in a directory
> of my own choosing, but then I have to tell cmake where to look for my 
> override files.
> 
> Is that correct?

I think the best way to override flags is to do it from your 
CMakeLists.txt project files (or through files included by them so you 
can use your externals scheme).  The <os>-<compiler> files are used to 
initialize the flags, you can modify them at configure time from your 
CMakeLists.txt files.  If you want to override them completely, you can 
do something like

set( CMAKE_CXX_FLAGS_<CONFIG> "-f1 -f2..." )

If you want to append to what CMake starts off with, you can do

set( CMAKE_CXX_FLAGS_<CONFIG> "${CMAKE_CXX_FLAGS_<CONFIG>} -f1 -f2..." )

> 
> How to I tell cmake that I want it to look in another directory?
> 
> Thanks.....John
> 
> 
> 
> 


-- 
Will Dicharry
Software Developer
Stellar Science Ltd Co
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090820/aaa77cae/attachment.bin>


More information about the CMake mailing list