From f76d76728d5067dd66a6e416de5be4fcccca72e1 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Mon, 4 Aug 2014 17:40:56 +0900 Subject: [PATCH 1/2] Fixed some mistakes in the CMake module for float types. --- cmake/modules/TestFloatFormat.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/TestFloatFormat.cmake b/cmake/modules/TestFloatFormat.cmake index 0e90cde6..c1bc568f 100644 --- a/cmake/modules/TestFloatFormat.cmake +++ b/cmake/modules/TestFloatFormat.cmake @@ -2,12 +2,13 @@ MACRO(TEST_FLOAT_FORMAT FP_IEEE754) IF(NOT FP_IEEE754) - TRY_COMPILE(HAVE_${FP_IEEE754} "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestFloatFormat.c" + TRY_COMPILE(HAVE_FLOAT_FORMAT_BIN + "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/cmake/TestFloatFormat.c" COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestFloatFormat.bin") SET(FP_IEEE754 0) - IF(HAVE_${FP_IEEE754}) + IF(HAVE_FLOAT_FORMAT_BIN) # dont match first/last letter because of string rounding errors :-) FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestFloatFormat.bin" From 590cb29f995d9171c6b535e98e2869690c6b5282 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Wed, 6 Aug 2014 20:57:04 +0900 Subject: [PATCH 2/2] Improved the CMake check for float/double format. (Intel compiler support) --- cmake/TestFloatFormat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/TestFloatFormat.c b/cmake/TestFloatFormat.c index 5f18aafb..4a7b32e4 100644 --- a/cmake/TestFloatFormat.c +++ b/cmake/TestFloatFormat.c @@ -1,5 +1,7 @@ -int main() +int main(int argc, char **argv) { + int ret = 0; + double bin1[] = { // "*TAGLIB*" encoded as a little-endian floating-point number (double)3.9865557444897601e-105, (double)0.0 @@ -8,6 +10,8 @@ int main() // "*TL*" encoded as a little-endian floating-point number (float)1.81480400e-013, (float)0.0 }; + ret += ((int*)bin1)[argc]; + ret += ((int*)bin2)[argc]; - return 0; + return ret; }