[CMake] ICC under Linux

Oliver Smith osmith at playnet.com
Tue Mar 23 22:46:22 EDT 2010


When you tell CMake under Linux to use ICC, there's no automatic 
detection of the custom archiver and linker that ICC requires. The 
following lines fix that, but would it be possible to add them to the 
stock CMake files someplace so that using ICC becomes slightly more 
transparent?

	# Intel(R) Compiler has its own library archiver,
	# if you build libraries and do not use xiar,
	# the Intel compiler will complain about invalid
	# archives at the link phase.

	# The Intel(R) archiver is "xiar" usually
	# located in the same folder as the compiler,
	# /opt/intel/Compiler/nn/n.nn/ia32/bin/xiar
	# for example.

	FIND_PROGRAM(XIAR xiar)
	IF(XIAR)
	  SET(CMAKE_AR "${XIAR}")
	ENDIF(XIAR)
	MARK_AS_ADVANCED(XIAR)

	# Intel(R) Compiler also comes with its own linker
	# which provides a number of additional benefits when
	# linking code compiled with the Intel(R) compiler.
	# Again, usually in the same place as icc itself,

	# /opt/intel/COmpiler/nn/n.nn/ia32/bin/xild per e.g

	FIND_PROGRAM(XILD xild)
	IF(XILD)
	  SET(CMAKE_LINKER "${XILD}")
	ENDIF(XILD)
	MARK_AS_ADVANCED(XILD)




More information about the CMake mailing list