Adding support to Compaq Compiler on Windows - Contribution from Davis Vowles sent...
authorjulie <julielangou@users.noreply.github.com>
Wed, 20 Jan 2016 15:45:15 +0000 (15:45 +0000)
committerjulie <julielangou@users.noreply.github.com>
Wed, 20 Jan 2016 15:45:15 +0000 (15:45 +0000)
CMakeLists.txt

index 254bcbc..a07cc35 100644 (file)
@@ -46,6 +46,33 @@ if (UNIX)
    STRING(REPLACE \;mtsk\; \; CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}")
 endif ()
 
+if ( CMAKE_Fortran_COMPILER_ID STREQUAL "Compaq" )
+   if ( WIN32 )
+      if (CMAKE_GENERATOR STREQUAL "NMake Makefiles")
+         get_filename_component(CMAKE_Fortran_COMPILER_CMDNAM ${CMAKE_Fortran_COMPILER} NAME_WE)
+         message(STATUS "Using Compaq Fortran compiler with command name ${CMAKE_Fortran_COMPILER_CMDNAM}")
+         set( cmd ${CMAKE_Fortran_COMPILER_CMDNAM} )  
+         string( TOLOWER "${cmd}" cmdlc )
+         if ( cmdlc STREQUAL "df" )      
+            message(STATUS "Assume the Compaq Visual Fortran Compiler is being used")
+            set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+            set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_INCLUDES 1)
+            #This is a workaround that is needed to avoid forward-slashes in the
+            #filenames listed in response files from incorrectly being interpreted as
+            #introducing compiler command options
+          if (${BUILD_SHARED_LIBS})
+               message(FATAL_ERROR "Making of shared libraries with CVF has not been tested.")
+            endif()   
+            set(str "NMake version 9 or later should be used. NMake version 6.0 which is\n")
+            set(str "${str}   included with the CVF distribution fails to build Lapack because\n")
+            set(str "${str}   the number of source files exceeds the limit for NMake v6.0\n")
+            message(STATUS ${str})
+            set(CMAKE_Fortran_LINK_EXECUTABLE "LINK /out:<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>")
+         endif()
+      endif()
+   endif()         
+endif()
+
 # Get Python
 find_package(PythonInterp)
 message(STATUS "Looking for Python found - ${PYTHONINTERP_FOUND}")