From 65fe2f907900683621b26fa3d3b6380148c732ac Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 9 Feb 2018 16:02:34 +0100 Subject: [PATCH] Add another compile-time check to Adol-C CMake module. --- cmake/configure/configure_adolc.cmake | 29 +++++++++++++++++++++++++++ cmake/modules/FindADOLC.cmake | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/cmake/configure/configure_adolc.cmake b/cmake/configure/configure_adolc.cmake index d76d14233d..7a1b043293 100644 --- a/cmake/configure/configure_adolc.cmake +++ b/cmake/configure/configure_adolc.cmake @@ -48,6 +48,21 @@ MACRO(FEATURE_ADOLC_FIND_EXTERNAL var) }" ADOLC_DOUBLE_CAST_CHECK) + CHECK_CXX_SOURCE_COMPILES(" + #include + #include + #include + int main (int argc, char *argv[]) + { + const adouble val_taped = 1.0; + const adtl::adouble val_tapeless = 1.0; + + std::ostringstream ss; + ss << val_taped; + ss << val_tapeless; + }" + ADOLC_ADOUBLE_OSTREAM_CHECK) + IF(NOT ADOLC_DOUBLE_CAST_CHECK) MESSAGE(STATUS "Could not find a sufficient ADOL-C installation: " @@ -61,6 +76,20 @@ MACRO(FEATURE_ADOLC_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + IF(NOT ADOLC_ADOUBLE_OSTREAM_CHECK) + MESSAGE(STATUS + "Could not find a sufficient ADOL-C installation: " + "deal.II needs ADOL-C version 2.6.4 or newer." + ) + SET(ADOLC_ADDITIONAL_ERROR_STRING + ${ADOLC_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient ADOL-C installation:\n" + "ADOL-C stream output check failed.\n" + "deal.II needs ADOL-C version 2.6.4 or newer." + ) + SET(${var} FALSE) + ENDIF() ENDIF() ENDMACRO() diff --git a/cmake/modules/FindADOLC.cmake b/cmake/modules/FindADOLC.cmake index 851d3e051a..8cf9263ccb 100644 --- a/cmake/modules/FindADOLC.cmake +++ b/cmake/modules/FindADOLC.cmake @@ -83,5 +83,5 @@ DEAL_II_PACKAGE_HANDLE(ADOLC INCLUDE_DIRS REQUIRED ADOLC_INCLUDE_DIR USER_INCLUDE_DIRS REQUIRED ADOLC_INCLUDE_DIR CLEAR ADOLC_INCLUDE_DIR ADOLC_LIBRARY ADOLC_SETTINGS_H - ADOLC_DOUBLE_CAST_CHECK # clean up check in configure_adolc.cmake + ADOLC_DOUBLE_CAST_CHECK ADOLC_ADOUBLE_OSTREAM_CHECK # clean up checks in configure_adolc.cmake ) -- 2.39.5