From e3a45173b50f698591071fdd38e511bd5a8d2ea8 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 4 Jun 2007 19:30:50 +0000 Subject: [PATCH] argh, forgot to svn add... --- cmake/CheckAlwaysInline.cmake | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cmake/CheckAlwaysInline.cmake diff --git a/cmake/CheckAlwaysInline.cmake b/cmake/CheckAlwaysInline.cmake new file mode 100644 index 000000000..ab5ceb0ac --- /dev/null +++ b/cmake/CheckAlwaysInline.cmake @@ -0,0 +1,44 @@ +# This module checks if the C++ compiler supports +# __attribute__((always_inline)). +# +# If yes, _RESULT is set to __attribute__((always_inline)). +# If no, _RESULT is set to empty value. +# +# Copyright Benoit Jacob 2007 +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file in +# kdelibs/cmake/modules. + +INCLUDE(CheckCXXSourceCompiles) + +MACRO (CHECK_ALWAYS_INLINE _RESULT) + +SET(_CHECK_attribute_always_inline_SRC " + +#ifdef __GNUC__ +# define ALL_IS_WELL +#endif + +#ifdef __INTEL_COMPILER +# if (__INTEL_COMPILER == 800) || (__INTEL_COMPILER > 800) +# define ALL_IS_WELL +# endif +#endif + +#ifndef ALL_IS_WELL +# error I guess your compiler doesn't support __attribute__((always_inline)) +#endif + +int main(int argc, char *argv[]) { return 0; } +") + +CHECK_CXX_SOURCE_COMPILES("${_CHECK_attribute_always_inline_SRC}" + HAVE_attribute_always_inline) +IF(HAVE_attribute_always_inline) + SET(${_RESULT} "__attribute__((always_inline))") +ELSE(HAVE_attribute_always_inline) + SET(${_RESULT} ) # attribute always_inline unsupported +ENDIF(HAVE_attribute_always_inline) + +ENDMACRO (CHECK_ALWAYS_INLINE)