diff --git a/var/spack/repos/builtin/packages/cp2k/cmake-relwithdebinfo-2024.1.patch b/var/spack/repos/builtin/packages/cp2k/cmake-relwithdebinfo-2024.1.patch new file mode 100644 index 00000000000..b974527b8c1 --- /dev/null +++ b/var/spack/repos/builtin/packages/cp2k/cmake-relwithdebinfo-2024.1.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4526160ad..8218a7a3d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,6 +63,18 @@ string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) + string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) + string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_RELEASE + ${CMAKE_Fortran_FLAGS_RELEASE}) ++string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO ++ ${CMAKE_C_FLAGS_RELWITHDEBINFO}) ++string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ++ ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) ++string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_RELWITHDEBINFO ++ ${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}) ++string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_MINSIZEREL ++ ${CMAKE_C_FLAGS_MINSIZEREL}) ++string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_MINSIZEREL ++ ${CMAKE_CXX_FLAGS_MINSIZEREL}) ++string(REPLACE "-DNDEBUG" "" CMAKE_Fortran_FLAGS_MINSIZEREL ++ ${CMAKE_Fortran_FLAGS_MINSIZEREL}) + + find_package(PkgConfig) + diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 3b311585f25..ea01e433ebc 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -271,7 +271,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("cmake@3.22:", type="build") # DBCSR as external dependency - depends_on("dbcsr@2.6:") + depends_on("dbcsr@2.6: ~examples") depends_on("dbcsr+openmp", when="+openmp") depends_on("dbcsr+mpi", when="+mpi") depends_on("dbcsr+cuda", when="+cuda") @@ -340,6 +340,11 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0") patch("cmake-fixes-2023.2.patch", when="@2023.2 build_system=cmake") + # Allow compilation with build_type=RelWithDebInfo and build_type=MinSizeRel + # after NDEBUG support was dropped in https://github.com/cp2k/cp2k/pull/3172 + # The patch applies https://github.com/cp2k/cp2k/pull/3251 to version 2024.1 + patch("cmake-relwithdebinfo-2024.1.patch", when="@2024.1 build_system=cmake") + # Patch for an undefined constant due to incompatible changes in ELPA @when("@9.1:2022.2 +elpa") def patch(self):