[Cmake-commits] CMake branch, next, updated. v3.5.1-802-g08e5b04

Brad King brad.king at kitware.com
Tue Apr 5 09:29:54 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  08e5b04dde6d60a6663a8fce4525f471830fb024 (commit)
       via  1694112dfa4e6f5d35ff57c4d565544cf88c0754 (commit)
      from  fe7083245d8fb195238940742fbe81945f92b70f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08e5b04dde6d60a6663a8fce4525f471830fb024
commit 08e5b04dde6d60a6663a8fce4525f471830fb024
Merge: fe70832 1694112
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Apr 5 09:29:53 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 5 09:29:53 2016 -0400

    Merge topic 'find-blas-lapack-Fortran-only' into next
    
    1694112d Find{BLAS,LAPACK}: Fix when used in pure Fortran projects (#16039)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1694112dfa4e6f5d35ff57c4d565544cf88c0754
commit 1694112dfa4e6f5d35ff57c4d565544cf88c0754
Author:     Melven Roehrig-Zoellner <Melven.Roehrig-Zoellner at DLR.de>
AuthorDate: Sun Apr 3 23:00:44 2016 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 5 09:03:23 2016 -0400

    Find{BLAS,LAPACK}: Fix when used in pure Fortran projects (#16039)
    
    Use `CMAKE_<LANG>_COMPILER_LOADED` to detect enabled languages because
    `if( _LANGUAGES_ MATCHES C )` is always true on Windows as the RC
    language is activated automatically and matches C.

diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 546ada1..728494c 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -59,12 +59,7 @@ set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
 set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 
 # Check the language being used
-get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
-if( _LANGUAGES_ MATCHES Fortran )
-  set( _CHECK_FORTRAN TRUE )
-elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
-  set( _CHECK_FORTRAN FALSE )
-else()
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
   if(BLAS_FIND_REQUIRED)
     message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
   else()
@@ -132,7 +127,7 @@ if(_libraries_work)
   # Test this combination of libraries.
   set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
 #  message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
-  if (_CHECK_FORTRAN)
+  if (CMAKE_Fortran_COMPILER_LOADED)
     check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
   else()
     check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
@@ -483,7 +478,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
  if (NOT WIN32)
   set(LM "-lm")
  endif ()
- if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
   if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
     find_package(Threads)
   else()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 2708de0..a6bf89f 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -48,11 +48,20 @@
 
 set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 
-get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
-if (NOT _LANGUAGES_ MATCHES Fortran)
-include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
-else ()
+# Check the language being used
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+  if(LAPACK_FIND_REQUIRED)
+    message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.")
+  else()
+    message(STATUS "Looking for LAPACK... - NOT found (Unsupported languages)")
+    return()
+  endif()
+endif()
+
+if (CMAKE_Fortran_COMPILER_LOADED)
 include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+else ()
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
 endif ()
 include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
 
@@ -125,7 +134,7 @@ if(_libraries_work)
     set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
   endif()
 #  message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
-  if (NOT _LANGUAGES_ MATCHES Fortran)
+  if (NOT CMAKE_Fortran_COMPILER_LOADED)
     check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
   else ()
     check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
@@ -250,7 +259,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
   if (NOT WIN32)
     set(LM "-lm")
   endif ()
-  if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+  if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
     if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
       find_PACKAGE(Threads)
     else()

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindBLAS.cmake   |   11 +++--------
 Modules/FindLAPACK.cmake |   21 +++++++++++++++------
 2 files changed, 18 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list