Description: Fix FTBFS with multi-flag MPI compile options
 Split space-delimited MPI_COMPILE_FLAGS and unquote in target_compile_options.
Author: Viktor Pashaiev <w.paszajew@gmail.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/madness/+bug/2170321
Last-Update: 2026-10-10
--- a/external/mpi.cmake
+++ b/external/mpi.cmake
@@ -45,6 +45,7 @@
   string(REGEX REPLACE "[ ]?-pthread" "" MPI_COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
   string(REGEX REPLACE "[ ]?-pthread" "" MPI_LINK_FLAGS "${MPI_LINK_FLAGS}")
   set(MPI_LIBRARIES ${MPI_LIBRARIES} Threads::Threads)
+  separate_arguments(MPI_COMPILE_FLAGS)
 
   # MPIEXEC was deprecated in CMake 3.10
   if (CMAKE_VERSION VERSION_LESS 3.10.0)
--- a/src/madness/CMakeLists.txt
+++ b/src/madness/CMakeLists.txt
@@ -91,7 +91,7 @@
 if(MPI_FOUND)
   target_include_directories(madness PUBLIC ${MPI_INCLUDE_PATH})
   target_compile_definitions(madness PUBLIC -DMPICH_SKIP_MPICXX=1 -DOMPI_SKIP_MPICXX=1)
-  target_compile_options(madness PUBLIC "${MPI_COMPILE_FLAGS}")
+  target_compile_options(madness PUBLIC ${MPI_COMPILE_FLAGS})
   target_link_libraries(madness PUBLIC ${MPI_LINK_FLAGS})
   target_link_libraries(madness PUBLIC ${MPI_LIBRARIES})
 endif()
