From 1fb1dbd0b3884f014ab991e91581f9db65fc78b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org> Date: Wed, 14 Oct 2015 07:06:04 +0200 Subject: [PATCH] Revert "[CMake] Remove enable trick for SuperLU and ARPACKPP" The commit broke compiling / linking if one package was found but the includes / libraries were not added. We need a different approach to hide the ENABLE_* trick from the user and keep full testing capabilities. This reverts commit 276135607610630f5c63303d6fcefcf4e3baaf7b. --- cmake/modules/AddARPACKPPFlags.cmake | 2 +- cmake/modules/AddSuperLUFlags.cmake | 2 +- cmake/modules/FindARPACKPP.cmake | 3 ++- cmake/modules/FindSuperLU.cmake | 3 ++- config.h.cmake | 8 ++++---- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/modules/AddARPACKPPFlags.cmake b/cmake/modules/AddARPACKPPFlags.cmake index f7dee74e..651ce079 100644 --- a/cmake/modules/AddARPACKPPFlags.cmake +++ b/cmake/modules/AddARPACKPPFlags.cmake @@ -14,7 +14,7 @@ function(add_dune_arpackpp_flags _targets) get_target_property(_props ${_target} COMPILE_FLAGS) string(REPLACE "_props-NOTFOUND" "" _props "${_props}") set_target_properties(${_target} PROPERTIES COMPILE_FLAGS - "${_props} ${ARPACKPP_DUNE_COMPILE_FLAGS}") + "${_props} ${ARPACKPP_DUNE_COMPILE_FLAGS} -DENABLE_ARPACKPP=1") endforeach(_target ${_targets}) endif(ARPACKPP_FOUND) endfunction(add_dune_arpackpp_flags) diff --git a/cmake/modules/AddSuperLUFlags.cmake b/cmake/modules/AddSuperLUFlags.cmake index 78b5f97e..e087b89a 100644 --- a/cmake/modules/AddSuperLUFlags.cmake +++ b/cmake/modules/AddSuperLUFlags.cmake @@ -17,7 +17,7 @@ function(add_dune_superlu_flags) get_target_property(_props ${_target} COMPILE_FLAGS) string(REPLACE "_props-NOTFOUND" "" _props "${_props}") set_target_properties(${_target} PROPERTIES COMPILE_FLAGS - "${_props} ${SUPERLU_DUNE_COMPILE_FLAGS}") + "${_props} ${SUPERLU_DUNE_COMPILE_FLAGS} -DENABLE_SUPERLU=1") endforeach() endif(SUPERLU_FOUND) endfunction(add_dune_superlu_flags) diff --git a/cmake/modules/FindARPACKPP.cmake b/cmake/modules/FindARPACKPP.cmake index f68b851e..286ad7f0 100644 --- a/cmake/modules/FindARPACKPP.cmake +++ b/cmake/modules/FindARPACKPP.cmake @@ -137,6 +137,7 @@ set(HAVE_ARPACKPP ${ARPACKPP_FOUND}) # register all ARPACK++ related flags if(ARPACKPP_FOUND) - dune_register_package_flags(LIBRARIES "${ARPACKPP_LIBRARIES}" + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_ARPACKPP=1" + LIBRARIES "${ARPACKPP_LIBRARIES}" INCLUDE_DIRS "${ARPACKPP_INCLUDE_DIRS}") endif(ARPACKPP_FOUND) diff --git a/cmake/modules/FindSuperLU.cmake b/cmake/modules/FindSuperLU.cmake index 0426e3d6..4f04ee4b 100644 --- a/cmake/modules/FindSuperLU.cmake +++ b/cmake/modules/FindSuperLU.cmake @@ -135,6 +135,7 @@ set(HAVE_SUPERLU ${SUPERLU_FOUND}) # register all superlu related flags if(SUPERLU_FOUND) - dune_register_package_flags(LIBRARIES "${SUPERLU_DUNE_LIBRARIES}" + dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_SUPERLU=1" + LIBRARIES "${SUPERLU_DUNE_LIBRARIES}" INCLUDE_DIRS "${SUPERLU_INCLUDE_DIRS}") endif() diff --git a/config.h.cmake b/config.h.cmake index a4256b2b..d419a47c 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -28,11 +28,11 @@ /* end private */ -/* Define to 1 if the SuperLU library is available */ -#cmakedefine HAVE_SUPERLU 1 +/* Define to ENABLE_SUPERLU if the SuperLU library is available */ +#cmakedefine HAVE_SUPERLU ENABLE_SUPERLU -/* Define to 1 if the ARPACK++ library is available */ -#cmakedefine HAVE_ARPACKPP 1 +/* Define to ENABLE_ARPACKPP if the ARPACK++ library is available */ +#cmakedefine HAVE_ARPACKPP ENABLE_ARPACKPP /* define to 1 because older versions of SuperLU are no longer supported*/ #define SUPERLU_POST_2005_VERSION 1 -- GitLab