diff options
Diffstat (limited to 'Modules/CheckStructHasMember.cmake')
-rw-r--r-- | Modules/CheckStructHasMember.cmake | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 7fef857705..842a8fdb72 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -50,33 +50,33 @@ include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - set(_INCLUDE_FILES) - foreach (it ${_HEADER}) - string(APPEND _INCLUDE_FILES "#include <${it}>\n") - endforeach () - - if("x${ARGN}" STREQUAL "x") - set(_lang C) - elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") - set(_lang "${CMAKE_MATCH_1}") - else() - message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") - endif() - - set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " + set(_INCLUDE_FILES) + foreach (it ${_HEADER}) + string(APPEND _INCLUDE_FILES "#include <${it}>\n") + endforeach () + + if("x${ARGN}" STREQUAL "x") + set(_lang C) + elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$") + set(_lang "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n") + endif() + + set(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { - (void)sizeof(((${_STRUCT} *)0)->${_MEMBER}); - return 0; + (void)sizeof(((${_STRUCT} *)0)->${_MEMBER}); + return 0; } ") - if("${_lang}" STREQUAL "C") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - elseif("${_lang}" STREQUAL "CXX") - CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - else() - message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") - endif() + if("${_lang}" STREQUAL "C") + CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + elseif("${_lang}" STREQUAL "CXX") + CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + else() + message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n") + endif() endmacro () |