summaryrefslogtreecommitdiff
path: root/Modules/TestBigEndian.cmake
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2018-04-24 08:09:47 +0200
committerBrad King <brad.king@kitware.com>2018-04-24 11:18:43 -0400
commit7b1c5f9f05bb8f3b48a5284cc236f1b483b70cf9 (patch)
tree7071c726d93f871029142572db97359dc82e54c5 /Modules/TestBigEndian.cmake
parent3db40923295a6430eb957a3cf6826bbb18a78527 (diff)
downloadcmake-7b1c5f9f05bb8f3b48a5284cc236f1b483b70cf9.tar.gz
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.
Diffstat (limited to 'Modules/TestBigEndian.cmake')
-rw-r--r--Modules/TestBigEndian.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index cc627d0168..9a4bce535c 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -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")