From 2e2ac084b1ef3a2816bb1c5ef798ca1c09b82f91 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 18 Dec 2017 07:30:10 -0600 Subject: [PATCH] CMake: correctly cache TestBoostBug, clean up cached variables This commit ensures that the test result of TestBoostBug is correctly cached (similarly to all other compilation checks). Further, make sure that all cached variables for compatibility checks for ADOLC and Boost are correctly unset again. --- cmake/configure/configure_boost.cmake | 78 +++++++++++++++------------ cmake/modules/FindADOLC.cmake | 1 + cmake/modules/FindBOOST.cmake | 2 + cmake/modules/FindLAPACK.cmake | 2 +- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/cmake/configure/configure_boost.cmake b/cmake/configure/configure_boost.cmake index bc4982ebdc..761f6d43a4 100644 --- a/cmake/configure/configure_boost.cmake +++ b/cmake/configure/configure_boost.cmake @@ -92,7 +92,7 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var) IF(DEAL_II_WITH_ZLIB) # - # Test that Boost.Iostreams is usuable. + # Test that Boost.Iostreams is usable. # RESET_CMAKE_REQUIRED() PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") @@ -117,11 +117,9 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var) decompressing_stream.write (test, 1); } " - _boost_iostreams_usuable + BOOST_IOSTREAMS_USABLE ) - IF(${_boost_iostreams_usuable}) - MESSAGE(STATUS "Boost.Iostreams is usuable.") - ELSE() + IF(NOT ${BOOST_IOSTREAMS_USABLE}) MESSAGE(STATUS "DEAL_II_WITH_ZLIB=ON requires Boost.Iostreams to be compiled " "with zlib support but a simple test failed! " @@ -134,36 +132,50 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() RESET_CMAKE_REQUIRED() - ENDIF() + ENDIF() # DEAL_II_WITH_ZLIB - IF(${var} AND DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - FILE(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug) - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug) - EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - "-DBOOST_INCLUDE_DIRS=${BOOST_INCLUDE_DIRS}" - "-DBOOST_LIBRARIES=${BOOST_LIBRARIES}" - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure/TestBoostBug - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug - RESULT_VARIABLE _boost_serialization_usuable - OUTPUT_QUIET - ERROR_QUIET - ) - IF(${_boost_serialization_usuable} EQUAL 0) - EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} --build . --target run - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug - RESULT_VARIABLE _boost_serialization_usuable - OUTPUT_QUIET - ERROR_QUIET - ) + IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) + # + # Test that Boost.Serialization is usable. + # + IF(NOT DEFINED BOOST_SERIALIZATION_USABLE OR NOT ${BOOST_SERIALIZATION_USABLE}) + # Only run this check if it hasn't successfully run previously. + MESSAGE(STATUS "Performing Test BOOST_SERIALIZATION_USABLE") + IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) + FILE(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug) + FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + "-DBOOST_INCLUDE_DIRS=${BOOST_INCLUDE_DIRS}" + "-DBOOST_LIBRARIES=${BOOST_LIBRARIES}" + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure/TestBoostBug + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_QUIET + ) + IF(${_result} EQUAL 0) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} --build . --target run + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_QUIET + ) + ENDIF() + ENDIF() + IF(${_result} EQUAL 0) + MESSAGE(STATUS "Performing Test BOOST_SERIALIZATION_USABLE - Success") + SET(BOOST_SERIALIZATION_USABLE TRUE CACHE INTERNAL "") + ELSE() + MESSAGE(STATUS "Performing Test BOOST_SERIALIZATION_USABLE - Failed") + SET(BOOST_SERIALIZATION_USABLE FALSE) + ENDIF() ENDIF() - IF(${_boost_serialization_usuable} EQUAL 0) - MESSAGE(STATUS "Boost.Serialization is usuable.") - ELSE() + IF(NOT ${BOOST_SERIALIZATION_USABLE}) MESSAGE(STATUS "The externally provided Boost.Serialization library " "failed to pass a crucial test. \n" @@ -177,7 +189,7 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() - ENDIF() + ENDIF() # DEAL_II_ALLOW_PLATFORM_INTROSPECTION ENDIF() ENDMACRO() diff --git a/cmake/modules/FindADOLC.cmake b/cmake/modules/FindADOLC.cmake index 58c7ed354c..1839774429 100644 --- a/cmake/modules/FindADOLC.cmake +++ b/cmake/modules/FindADOLC.cmake @@ -83,4 +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 ) diff --git a/cmake/modules/FindBOOST.cmake b/cmake/modules/FindBOOST.cmake index 5e87898685..43be610a12 100644 --- a/cmake/modules/FindBOOST.cmake +++ b/cmake/modules/FindBOOST.cmake @@ -103,4 +103,6 @@ DEAL_II_PACKAGE_HANDLE(BOOST Boost_LIBRARY_DIR_DEBUG Boost_LIBRARY_DIR_RELEASE _Boost_COMPONENTS_SEARCHED _Boost_INCLUDE_DIR_LAST _Boost_LIBRARY_DIR_LAST _Boost_USE_MULTITHREADED_LAST + BOOST_IOSTREAMS_USABLE # clean up check in configure_boost.cmake + BOOST_SERIALIZATION_USABLE # clean up check in configure_boost.cmake ) diff --git a/cmake/modules/FindLAPACK.cmake b/cmake/modules/FindLAPACK.cmake index 001e5ce948..abc32db46d 100644 --- a/cmake/modules/FindLAPACK.cmake +++ b/cmake/modules/FindLAPACK.cmake @@ -87,5 +87,5 @@ DEAL_II_PACKAGE_HANDLE(LAPACK eigen_blas_LIBRARY f77blas_LIBRARY gslcblas_LIBRARY lapack_LIBRARY m_LIBRARY ptf77blas_LIBRARY ptlapack_LIBRARY refblas_LIBRARY reflapack_LIBRARY BLAS_LIBRARIES ${_additional_libraries} - LAPACK_SYMBOL_CHECK # Cleanup check in configure_1_lapack.cmake + LAPACK_SYMBOL_CHECK # clean up check in configure_1_lapack.cmake ) -- 2.39.5