Trilinos config problem in FiniteValue.cmake and GCC 5.4.0
Created by: raovgarimella
Trilinos 12.6.1 and 12.10.1 configuration fails with gcc 5.4.0 and cmake 3.5.1 because of an issue with trilinos/cmake/tribits/core/config_tests/FiniteValue.cmake. The complaint is that "isnan was not declared in this scope
".
Upon investigating further, it seems that FiniteValue.cmake tries to test for existence of 'isnan
' within the global namespace and the std::
namespace but in both cases uses the <cmath>
header.
According to the following post on StackOverflow, it seems however that one should include <math.h>
when calling 'isnan
' and <cmath>
when calling 'std::isnan
'
Making this change allows the configuration to proceed. I checked and this problem persists in the HEAD version of the master as well.
Here is a trivial patch file for fixing the problem in 12.10.1 release
--- cmake/tribits/core/config_tests/FiniteValue.cmake 2016-11-22 15:43:07.000000000 -0700
+++ cmake/tribits/core/config_tests/FiniteValue.cmake.new 2017-04-26 22:27:08.016402800 -0600
@@ -58,7 +58,7 @@ INCLUDE(CheckCXXSourceCompiles)
SET(SOURCE_GLOBAL_ISNAN
"
-#include <cmath>
+#include <math.h>
int main()
{
double x = 1.0;
@@ -105,7 +105,7 @@ ENDIF()
SET(SOURCE_GLOBAL_ISINF
"
-#include <cmath>
+#include <math.h>
int main()
{
double x = 1.0;