scalapack icon indicating copy to clipboard operation
scalapack copied to clipboard

error during the configuration with cmake

Open GengSS opened this issue 2 years ago • 2 comments

Hi, I am using the cmake to configure the scalapack 2.1.0, However, I encountered an error like below

CMake Error at BLACS/TESTING/CMakeLists.txt:4 (if):
  if given arguments:

    "GNU" "STREQUAL" "GNU" "AND" "CMAKE_Fortran_COMPILER_VERSION" "VERSION_GREATER_EQUAL" "10"

  Unknown arguments specified

and Following are the contents of BLACS/TESTING/CMakeLists.txt

set(FTestObj
   blacstest.f btprim.f tools.f)

if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
    set_source_files_properties(blacstest.f PROPERTIES COMPILE_FLAGS "-std=legacy")
endif()

Is this a bug? thank you very much Best, Geng

GengSS avatar Jun 07 '22 08:06 GengSS

It may be caused by an older CMake. The operator VERSION_GREATER_EQUAL was introduced in CMake 3.7 (https://cmake.org/cmake/help/latest/command/if.html#version-greater-equal), and ScaLAPACK only asks for CMake 3.2:

https://github.com/Reference-ScaLAPACK/scalapack/blob/5bad7487f496c811192334640ce4d3fc5f88144b/CMakeLists.txt#L1

One possible solution is to ask for CMake 3.7 in ScaLAPACK:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c33719..0216bfa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.2)
+cmake_minimum_required(VERSION 3.7)
 
 project(SCALAPACK VERSION 2.2.1 LANGUAGES C Fortran)

[Update:] I implemented this solution at #65.

weslleyspereira avatar Jul 07 '22 18:07 weslleyspereira

Hi @GengSS. Could you verify if #65 solves this issue. Thanks!

weslleyspereira avatar Jul 25 '22 17:07 weslleyspereira

Hi @GengSS. Could you verify if #65 solves this issue. Thanks!

Dear @weslleyspereira , thank you very much. I tested the solution and switched to a recent version for CMake, and it solved the issue.

GengSS avatar Nov 08 '22 06:11 GengSS