[CMake] Compaq Visual Fortran

Arjen Markus arjen.markus at deltares.nl
Thu Jan 28 11:23:08 EST 2010


Hi Brad,

I will try the new patch tomorrow.

I tried printing it as an ordinary variable or constant, but that did
not work: variable names are not allowed to start with an underscore.

Regards,

Arjen

On 2010-01-28 17:18, Brad King wrote:
> Arjen Markus wrote:
>>> Perhaps this means that _DF_VERSION_ is available only as a Fortran
>>> language symbol.
>> It would look that way, but what use would it have then?
> 
> Perhaps it can be used in regular (runtime) IF tests?  Of course other
> compilers won't define it, so it's useful only in vendor-specific code.
> 
>> I ran f90 -what:
>>
>> Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update C)
>> Copyright 2003 Compaq Computer Corp. All rights reserved.
>>
>> Compaq Visual Fortran 6.6-4088-47D3B
>> C:\Program Files\Microsoft Visual Studio\DF98\BIN\decfor90.exe
> 
> Thanks.  Undo the previous patch and try the one below instead.
> 
> -Brad
> 
> 
> diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
> index a70c6ab..bf4176c 100644
> --- a/Modules/CMakeDetermineCompilerId.cmake
> +++ b/Modules/CMakeDetermineCompilerId.cmake
> @@ -42,6 +42,11 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
>      ENDIF(NOT CMAKE_${lang}_COMPILER_ID)
>    ENDFOREACH(flags)
> 
> +  # If the compiler is still unknown, try to query its vendor.
> +  IF(NOT CMAKE_${lang}_COMPILER_ID)
> +    CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang})
> +  ENDIF()
> +
>    # if the format is unknown after all files have been checked, put "Unknown" in the cache
>    IF(NOT CMAKE_EXECUTABLE_FORMAT)
>      SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
> @@ -245,3 +250,32 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
>      PARENT_SCOPE)
>    SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
>  ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang)
> +
> +#-----------------------------------------------------------------------------
> +# Function to query the compiler vendor.
> +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
> +  FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
> +    SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
> +    SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
> +    EXECUTE_PROCESS(
> +      COMMAND ${CMAKE_${lang}_COMPILER}
> +      ${CMAKE_${lang}_COMPILER_ID_ARG1}
> +      ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
> +      ${flags}
> +      WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
> +      OUTPUT_VARIABLE output ERROR_VARIABLE output
> +      RESULT_VARIABLE result
> +      )
> +    IF("${output}" MATCHES "${regex}")
> +      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
> +        "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
> +        "matched \"${regex}\":\n${output}")
> +      SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
> +      BREAK()
> +    ELSE()
> +      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
> +        "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
> +        "did not match \"${regex}\":\n${output}")
> +    ENDIF()
> +  ENDFOREACH()
> +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR)
> diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
> index 44e45d8..0637d20 100644
> --- a/Modules/CMakeDetermineFortranCompiler.cmake
> +++ b/Modules/CMakeDetermineFortranCompiler.cmake
> @@ -162,6 +162,11 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
>      "-fpp"
>      )
> 
> +  # Table of per-vendor compiler id flags with expected output.
> +  LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq)
> +  SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what")
> +  SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran")
> +
>    # Try to identify the compiler.
>    SET(CMAKE_Fortran_COMPILER_ID)
>    INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
> 


More information about the CMake mailing list