diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-06-04 19:30:50 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2007-06-04 19:30:50 +0000 |
commit | e3a45173b50f698591071fdd38e511bd5a8d2ea8 (patch) | |
tree | fbce5eb65791af9b376ac91f8099b074aac28d69 /cmake | |
parent | e198eb437ce6fbf69c7debe612ebaec628ab2ca2 (diff) |
argh, forgot to svn add...
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/CheckAlwaysInline.cmake | 44 |
1 files changed, 44 insertions, 0 deletions
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 <jacob@math.jussieu.fr> +# +# 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) |