scivision/mumps

Request to add "-Wno-implicit-function-declaration" flag to silence implicit function declaration error

puneetmatharu opened this issue · 1 comments

Hi,

I was trying to build the MUMPS library as part of a separate CMake-based project and when I do, I get -Wimplicit-function-declaration warnings which flare up as errors. To address this, I currently have a patch file that adds the C flag -Wno-implicit-function-declaration using the following code:

# Append to current flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")

ExternalProject_Add(
  SCALAPACK
  GIT_REPOSITORY ${scalapack_git}
  GIT_TAG ${scalapack_tag}
  UPDATE_DISCONNECTED ${EP_UPDATE_DISCONNECTED}
  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SCALAPACK_ROOT}
             -DLAPACK_ROOT:PATH=${LAPACK_ROOT}
             -DBUILD_SHARED_LIBS:BOOL=false
             -DCMAKE_BUILD_TYPE=Release
             -DBUILD_TESTING:BOOL=false
             -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}      # Specify flags in CMake arguments
  CMAKE_CACHE_ARGS -Darith:STRING=${arith}
  PATCH_COMMAND ${PATCH_COMMAND}
  BUILD_BYPRODUCTS ${SCALAPACK_LIBRARIES} 
  INACTIVITY_TIMEOUT 30
  CONFIGURE_HANDLED_BY_BUILD ON)

Would you have any problem with adding this flag in to prevent it from blocking the build of the project? I think this would be helpful for projects that pull MUMPS in using FetchControl or ExternalProject. If you'd like, I could create a PR for this.

Thanks!
Puneet

P.S. As I write this, I see that it would be more natural to append the flags with the following code:

# Append to current flags
list(APPEND CMAKE_C_FLAGS -Wno-implicit-function-declaration)

Hi, in the commit that you closed this issue with, you added a flag to scalapack_c_flags to remove the aforementioned warning. However, it only accounts for the case that the user is using a GNU compiler. It unfortunately does not address the issue I encountered on MacOS (for which the compiler is Clang). Could you please adjust the code in cmake/scalapack.cmake to account for this? Thank you.