CheckTypeSize: Support for CXX when C language is not enabled
This example now works without need to enable C language: cmake_minimum_required(VERSION x.x.x) project(foo CXX) include(CheckTypeSize) check_type_size("short" SIZEOF_SHORT LANGUAGE CXX) Fixes #14056
This commit is contained in:
parent
3c6943eb9d
commit
7d6d45f23c
|
@ -75,6 +75,7 @@
|
||||||
# License text for the above reference.)
|
# License text for the above reference.)
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
|
||||||
cmake_policy(PUSH)
|
cmake_policy(PUSH)
|
||||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||||
|
@ -218,9 +219,15 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
|
||||||
set(_builtin 0)
|
set(_builtin 0)
|
||||||
else()
|
else()
|
||||||
set(_builtin 1)
|
set(_builtin 1)
|
||||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
if("${_language}" STREQUAL "C")
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
check_include_file(stdint.h HAVE_STDINT_H)
|
||||||
|
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||||
|
elseif("${_language}" STREQUAL "CXX")
|
||||||
|
check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
|
||||||
|
check_include_file_cxx(stdint.h HAVE_STDINT_H)
|
||||||
|
check_include_file_cxx(stddef.h HAVE_STDDEF_H)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
|
unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
|
||||||
unset(_CHECK_TYPE_SIZE_LANGUAGE)
|
unset(_CHECK_TYPE_SIZE_LANGUAGE)
|
||||||
|
|
Loading…
Reference in New Issue