mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
TestBigEndian: Include CheckTypeSize outside macro
When using https://github.com/cristianadam/cmake-checks-cache I have noticed that CheckTypeSize would in certain cases have an empty `__check_type_size_dir` variable. The errors would point to `TestBigEndian`. By moving `include(CheckTypeSize)` outside the macro, the errors go away. Including dependencies of a module when the module is first included is simpler and cleaner anyway.
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
# TEST_BIG_ENDIAN(VARIABLE)
|
||||
# VARIABLE - variable to store the result to
|
||||
|
||||
include(CheckTypeSize)
|
||||
|
||||
macro(TEST_BIG_ENDIAN VARIABLE)
|
||||
if(NOT DEFINED HAVE_${VARIABLE})
|
||||
message(STATUS "Check if the system is big endian")
|
||||
@@ -27,8 +29,6 @@ macro(TEST_BIG_ENDIAN VARIABLE)
|
||||
message(FATAL_ERROR "TEST_BIG_ENDIAN needs either C or CXX language enabled")
|
||||
endif()
|
||||
|
||||
include(CheckTypeSize)
|
||||
|
||||
CHECK_TYPE_SIZE("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT LANGUAGE ${_test_language})
|
||||
if(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
|
||||
message(STATUS "Using unsigned short")
|
||||
|
||||
Reference in New Issue
Block a user