From 57283dc8e28d962210c2987f8886650be2496be0 Mon Sep 17 00:00:00 2001 From: Raul Laasner Date: Wed, 5 Aug 2015 15:02:15 +0300 Subject: [PATCH 1/4] Prevented CMAKE_Fortran_COMPILER_VERSION from becoming undefined --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c02c5051e..1e9886e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,9 @@ endif() if (CMAKE_VERSION VERSION_GREATER 3.2.3) # Detect Fortran compiler version directly + set(CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} + CACHE STRING "") + mark_as_advanced(FORCE CMAKE_Fortran_COMPILER_VERSION) if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) set(opencoarrays_aware_compiler true) add_definitions(-DPREFIX_NAME=_gfortran_caf_) From 20833ec1c7b2f02d12e726b4e71c1480d01c50b2 Mon Sep 17 00:00:00 2001 From: Raul Laasner Date: Wed, 5 Aug 2015 18:19:04 +0300 Subject: [PATCH 2/4] The proposed change corresponds to a bug that will be fixed in 3.3.1. Until then, a temporary fix is required. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e9886e7b..01f95e76f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,13 @@ cmake_minimum_required(VERSION 3.0) #Name project and specify source languages project(opencoarrays VERSION 2.0.0 LANGUAGES C Fortran) +# Temporary fix +if (CMAKE_VERSION VERSION_EQUAL 3.3.0) + set(CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} + CACHE STRING "") + mark_as_advanced(FORCE CMAKE_Fortran_COMPILER_VERSION) +endif() + #Print an error message on an attempt to build inside the source directory tree: if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") message(FATAL_ERROR "ERROR! " @@ -42,9 +49,6 @@ endif() if (CMAKE_VERSION VERSION_GREATER 3.2.3) # Detect Fortran compiler version directly - set(CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} - CACHE STRING "") - mark_as_advanced(FORCE CMAKE_Fortran_COMPILER_VERSION) if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) set(opencoarrays_aware_compiler true) add_definitions(-DPREFIX_NAME=_gfortran_caf_) From 49e2475db7091351b8c02274f36fae94cc9391e8 Mon Sep 17 00:00:00 2001 From: Raul Laasner Date: Mon, 10 Aug 2015 11:45:28 +0300 Subject: [PATCH 3/4] Improved the inequality tests for version numbers. --- CMakeLists.txt | 6 +++--- src/mpi/CMakeLists.txt | 6 +++--- src/tests/unit/extensions/CMakeLists.txt | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f95e76f..3e08ba5f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,9 @@ else() ) endif() -if (CMAKE_VERSION VERSION_GREATER 3.2.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3) # Detect Fortran compiler version directly - if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) + if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) add_definitions(-DPREFIX_NAME=_gfortran_caf_) else() @@ -58,7 +58,7 @@ if (CMAKE_VERSION VERSION_GREATER 3.2.3) endif() else() # Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG) - if(gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0.0)) + if(gfortran_compiler AND (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) add_definitions(-DPREFIX_NAME=_gfortran_caf_) else() diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt index db735974c..917cc4be6 100644 --- a/src/mpi/CMakeLists.txt +++ b/src/mpi/CMakeLists.txt @@ -8,16 +8,16 @@ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Cray") set(cray_compiler true) endif() -if (CMAKE_VERSION VERSION_GREATER 3.2.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3) # Detect Fortran compiler version directly - if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0)) + if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) else() set(opencoarrays_aware_compiler false) endif() else() # Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG) - if(gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0.0)) + if(gfortran_compiler AND (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) else() set(opencoarrays_aware_compiler false) diff --git a/src/tests/unit/extensions/CMakeLists.txt b/src/tests/unit/extensions/CMakeLists.txt index 19c1e06ca..33ffdd726 100644 --- a/src/tests/unit/extensions/CMakeLists.txt +++ b/src/tests/unit/extensions/CMakeLists.txt @@ -2,16 +2,16 @@ if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") set(gfortran_compiler true) endif() -if (CMAKE_VERSION VERSION_GREATER 3.2.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3) # Detect Fortran compiler version directly - if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 4.9.2)) + if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) else() set(opencoarrays_aware_compiler false) endif() else() # Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG) - if(gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.9.2)) + if(gfortran_compiler AND (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) else() set(opencoarrays_aware_compiler false) From 0af5cbba9295bced57d4f3ca25747d41e3cf445e Mon Sep 17 00:00:00 2001 From: Raul Laasner Date: Mon, 10 Aug 2015 11:51:16 +0300 Subject: [PATCH 4/4] It's better to remove the temporary fix and just require CMake to be at least 3.3.1. --- CMakeLists.txt | 9 +-------- src/mpi/CMakeLists.txt | 2 +- src/tests/unit/extensions/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e08ba5f6..ba78fd322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,13 +3,6 @@ cmake_minimum_required(VERSION 3.0) #Name project and specify source languages project(opencoarrays VERSION 2.0.0 LANGUAGES C Fortran) -# Temporary fix -if (CMAKE_VERSION VERSION_EQUAL 3.3.0) - set(CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} - CACHE STRING "") - mark_as_advanced(FORCE CMAKE_Fortran_COMPILER_VERSION) -endif() - #Print an error message on an attempt to build inside the source directory tree: if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") message(FATAL_ERROR "ERROR! " @@ -47,7 +40,7 @@ else() ) endif() -if (NOT CMAKE_VERSION VERSION_LESS 3.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3.1) # Detect Fortran compiler version directly if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt index 917cc4be6..6eee6ecea 100644 --- a/src/mpi/CMakeLists.txt +++ b/src/mpi/CMakeLists.txt @@ -8,7 +8,7 @@ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Cray") set(cray_compiler true) endif() -if (NOT CMAKE_VERSION VERSION_LESS 3.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3.1) # Detect Fortran compiler version directly if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true) diff --git a/src/tests/unit/extensions/CMakeLists.txt b/src/tests/unit/extensions/CMakeLists.txt index 33ffdd726..8c0ba7a72 100644 --- a/src/tests/unit/extensions/CMakeLists.txt +++ b/src/tests/unit/extensions/CMakeLists.txt @@ -2,7 +2,7 @@ if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") set(gfortran_compiler true) endif() -if (NOT CMAKE_VERSION VERSION_LESS 3.3) +if (NOT CMAKE_VERSION VERSION_LESS 3.3.1) # Detect Fortran compiler version directly if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)) set(opencoarrays_aware_compiler true)