From 4063acee6e925b36d1d0ef9681b5dc54b8041e30 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de> Date: Tue, 29 May 2018 13:51:01 +0200 Subject: [PATCH] DuneMPI: append flags to `COMPILE_OPTIONS` instead of `COMPILE_FLAGS` `COMPILE_FLAGS` is a string, but `set_property(... APPEND ...)` appends to a list. If the list of compile flags is not empty this results in a superfluous semicolon in the compile flags which will break the compiler invocation. For example, when `MPI_DUNE_COMPILE_FLAGS=-lpthread`, calling `add_dune_mpi_flags` twice for the same target would result in the compiler command containing `-lpthread;-lpthread`. This patch makes use of the `COMPILE_OPTIONS` property instead which is a list. --- cmake/modules/DuneMPI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/DuneMPI.cmake b/cmake/modules/DuneMPI.cmake index 54146d046..64e901e36 100644 --- a/cmake/modules/DuneMPI.cmake +++ b/cmake/modules/DuneMPI.cmake @@ -58,7 +58,7 @@ function(add_dune_mpi_flags) set(_prefix TARGET) endif() if(MPI_C_FOUND) - set_property(${_prefix} ${ADD_MPI_UNPARSED_ARGUMENTS} APPEND PROPERTY COMPILE_FLAGS ${MPI_DUNE_COMPILE_FLAGS}) + set_property(${_prefix} ${ADD_MPI_UNPARSED_ARGUMENTS} APPEND PROPERTY COMPILE_OPTIONS ${MPI_DUNE_COMPILE_FLAGS}) set_property(${_prefix} ${ADD_MPI_UNPARSED_ARGUMENTS} APPEND PROPERTY COMPILE_DEFINITIONS ENABLE_MPI=1 MPICH_SKIP_MPICXX MPIPP_H) if(NOT (ADD_MPI_SOURCE_ONLY OR ADD_MPI_OBJECT)) -- GitLab