Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Check for unsigned 64-bit integer types #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ check_include_files(stdint.h INCLUDE_STDINT_H)
check_include_files(sys/types.h INCLUDE_SYS_TYPES_H)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(SIZE16 int16_t)
set(USIZE16 uint16_t)
set(SIZE32 int32_t)
set(USIZE32 uint32_t)
set(SIZE64 int64_t)
set(USIZE64 uint64_t)

include(CheckSizes)

Expand Down
13 changes: 13 additions & 0 deletions cmake/CheckSizes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ check_type_size("int32_t" INT32_SIZE LANGUAGE C)
check_type_size("uint32_t" UINT32_SIZE LANGUAGE C)
check_type_size("u_int32_t" U_INT32_SIZE LANGUAGE C)
check_type_size("int64_t" INT64_SIZE LANGUAGE C)
check_type_size("uint64_t" UINT64_SIZE LANGUAGE C)
check_type_size("short" SHORT_SIZE LANGUAGE C)
check_type_size("int" INT_SIZE LANGUAGE C)
check_type_size("long" LONG_SIZE LANGUAGE C)
Expand Down Expand Up @@ -71,3 +72,15 @@ elseif(LONG_LONG_SIZE EQUAL 8)
else()
message(FATAL_ERROR "No 64 bit type found on this platform!")
endif()

if(UINT64_SIZE EQUAL 8)
set(USIZE64 "uint64_t")
elseif(INT_SIZE EQUAL 8)
set(USIZE64 "unsigned int")
elseif(LONG_SIZE EQUAL 8)
set(USIZE64 "unsigned long")
elseif(LONG_LONG_SIZE EQUAL 8)
set(USIZE64 "unsigned long long")
else()
message(FATAL_ERROR "No unsigned 64 bit type found on this platform!")
endif()