aboutsummaryrefslogtreecommitdiff
path: root/cmake/tuklib_integer.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/tuklib_integer.cmake')
-rw-r--r--cmake/tuklib_integer.cmake34
1 files changed, 18 insertions, 16 deletions
diff --git a/cmake/tuklib_integer.cmake b/cmake/tuklib_integer.cmake
index aeb7ff6f..d7e2e28c 100644
--- a/cmake/tuklib_integer.cmake
+++ b/cmake/tuklib_integer.cmake
@@ -7,7 +7,7 @@
# You can do whatever you want with this file.
#
-include(${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake)
+include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(TestBigEndian)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
@@ -22,7 +22,7 @@ function(tuklib_integer TARGET_OR_ALL)
if(NOT DEFINED WORDS_BIGENDIAN)
message(FATAL_ERROR "Cannot determine endianness")
endif()
- tuklib_add_definition_if(${TARGET_OR_ALL} WORDS_BIGENDIAN)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" WORDS_BIGENDIAN)
# Look for a byteswapping method.
check_c_source_compiles("
@@ -36,24 +36,25 @@ function(tuklib_integer TARGET_OR_ALL)
"
HAVE___BUILTIN_BSWAPXX)
if(HAVE___BUILTIN_BSWAPXX)
- tuklib_add_definitions(${TARGET_OR_ALL} HAVE___BUILTIN_BSWAPXX)
+ tuklib_add_definitions("${TARGET_OR_ALL}" HAVE___BUILTIN_BSWAPXX)
else()
check_include_file(byteswap.h HAVE_BYTESWAP_H)
if(HAVE_BYTESWAP_H)
- tuklib_add_definitions(${TARGET_OR_ALL} HAVE_BYTESWAP_H)
+ tuklib_add_definitions("${TARGET_OR_ALL}" HAVE_BYTESWAP_H)
check_symbol_exists(bswap_16 byteswap.h HAVE_BSWAP_16)
- tuklib_add_definition_if(${TARGET_OR_ALL} HAVE_BSWAP_16)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE_BSWAP_16)
check_symbol_exists(bswap_32 byteswap.h HAVE_BSWAP_32)
- tuklib_add_definition_if(${TARGET_OR_ALL} HAVE_BSWAP_32)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE_BSWAP_32)
check_symbol_exists(bswap_64 byteswap.h HAVE_BSWAP_64)
- tuklib_add_definition_if(${TARGET_OR_ALL} HAVE_BSWAP_64)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE_BSWAP_64)
else()
check_include_file(sys/endian.h HAVE_SYS_ENDIAN_H)
if(HAVE_SYS_ENDIAN_H)
- tuklib_add_definitions(${TARGET_OR_ALL} HAVE_SYS_ENDIAN_H)
+ tuklib_add_definitions("${TARGET_OR_ALL}" HAVE_SYS_ENDIAN_H)
else()
check_include_file(sys/byteorder.h HAVE_SYS_BYTEORDER_H)
- tuklib_add_definition_if(${TARGET_OR_ALL} HAVE_SYS_BYTEORDER_H)
+ tuklib_add_definition_if("${TARGET_OR_ALL}"
+ HAVE_SYS_BYTEORDER_H)
endif()
endif()
endif()
@@ -72,16 +73,17 @@ function(tuklib_integer TARGET_OR_ALL)
# on ARM and always assumes that unaligned is fast on ARM.
set(FAST_UNALIGNED_GUESS OFF)
if(CMAKE_SYSTEM_PROCESSOR MATCHES
- [Xx3456]86|^[Xx]64|^[Aa][Mm][Dd]64|^[Aa][Rr][Mm]|^aarch|^powerpc|^ppc)
+ "[Xx3456]86|^[Xx]64|^[Aa][Mm][Dd]64|^[Aa][Rr][Mm]|^aarch|^powerpc|^ppc")
if(NOT WORDS_BIGENDIAN OR
- NOT CMAKE_SYSTEM_PROCESSOR MATCHES ^powerpc|^ppc)
+ NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc|^ppc")
set(FAST_UNALIGNED_GUESS ON)
endif()
endif()
option(TUKLIB_FAST_UNALIGNED_ACCESS
- "Enable if the system supports *fast* unaligned memory access with 16-bit and 32-bit integers."
- ${FAST_UNALIGNED_GUESS})
- tuklib_add_definition_if(${TARGET_OR_ALL} TUKLIB_FAST_UNALIGNED_ACCESS)
+ "Enable if the system supports *fast* unaligned memory access \
+with 16-bit and 32-bit integers."
+ "${FAST_UNALIGNED_GUESS}")
+ tuklib_add_definition_if("${TARGET_OR_ALL}" TUKLIB_FAST_UNALIGNED_ACCESS)
# Unsafe type punning:
option(TUKLIB_USE_UNSAFE_TYPE_PUNNING
@@ -90,11 +92,11 @@ may result in broken code. However, this might improve performance \
in some cases, especially with old compilers \
(e.g. GCC 3 and early 4.x on x86, GCC < 6 on ARMv6 and ARMv7)."
OFF)
- tuklib_add_definition_if(${TARGET_OR_ALL} TUKLIB_USE_UNSAFE_TYPE_PUNNING)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" TUKLIB_USE_UNSAFE_TYPE_PUNNING)
# Check for GCC/Clang __builtin_assume_aligned().
check_c_source_compiles(
"int main(void) { __builtin_assume_aligned(\"\", 1); return 0; }"
HAVE___BUILTIN_ASSUME_ALIGNED)
- tuklib_add_definition_if(${TARGET_OR_ALL} HAVE___BUILTIN_ASSUME_ALIGNED)
+ tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE___BUILTIN_ASSUME_ALIGNED)
endfunction()