[CMake] Detecting Compiler

Mike Jackson imikejackson at gmail.com
Wed Jun 6 15:32:55 EDT 2007



On Jun 6, 2007, at 3:26 PM, Alexander Neundorf wrote:

> On Wednesday 06 June 2007 12:14, James Bigler wrote:
>> Hi,
>>
>> Mike Jackson wrote:
>>> I looked and looked but I know it is simple but I just can not  
>>> find the
>>> answer:
>>>
>>> I want to add some flags given a certain compiler (like the intel
>>> compiler).. how should I proceed?
>>>
>>> IF (COMPILER matches INTEL) ?? Will that work?
>>>
>>> This is on OS X if that matters.
>>>
>>>
>>> Also looking down in /usr/local/share/cmake/modules/platform I see a
>>> pair of Darwin.* files. Can we get one in there for the intel  
>>> compilers
>>> for OS X? what information is needed to build one?
>>
>> CMake seems to come with built in detection of GCC, but not for other
>> compilers (see Modules/CMakeDetermineCCompiler.cmake).
>
> Which compilers under which operatings systems do you use ? The  
> Intel compiler
> should actually be supported.
> Do you have cmake files for these compilers ?
> Could you please send them to the list ?
>
> Thanks
> Alex
> _______________________________________________

it is supported in the basic of cases. I can set CC and CXX to /usr/ 
bin/icpc and things generally work fine. But there are some  
differences in the linker invocations with the latest Intel version  
10 compiler (-shared instead of -dynamiclib). Also the intel compiler  
can be _Very_ verbose with remarks and warnings. I would like to turn  
some of those off using the -wdXXX,XXX options but there are some  
problems with that. CMake, as shipped, does NOT have a Darwin- 
icpc.cmake file. I made one up with some guess about things but not  
sure what all should be in there.


SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "")

SET(CMAKE_C_LINK_FLAGS "-static-intel -headerpad_max_install_names")
SET(CMAKE_CXX_LINK_FLAGS "-static-intel -headerpad_max_install_names")


SET (CMAKE_CXX_FLAGS_INIT "")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")
SET (CMAKE_C_FLAGS_INIT "")
SET (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")

Not sure what else to put in there.

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services



More information about the CMake mailing list