On Mon, Apr 04, 2016 at 09:07:09 +0000, melven.roehrig-zoell...@dlr.de wrote:
> After thinking about my patch I worried it could break other compilers.
> So, here is a more defensive version that shouldn't interfere with anything 
> else.
> 
> Explanation:
> CMAKE_Fortran_COMPILER_ID was correctly set to "GNU";
> If CMAKE_Fortran_PLATFORM_IS is missing, run gfortran with a C file
> -> fallback to C which has appropriate preprocessor definitions to recognize 
> MINGW.

+    exec_program(${CMAKE_Fortran_COMPILER}
+      ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E
+"\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\""
+      OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE
+CMAKE_COMPILER_RETURN)

Please use `execute_process` instead.

+    if(NOT CMAKE_COMPILER_RETURN)
+      if(NOT CMAKE_Fortran_PLATFORM_ID)

Is this not always true inside this block?

+        if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW")

Use:

    if (CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_MINGW")

+          set(CMAKE_Fortran_PLATFORM_ID "MinGW")
+        endif()
+        if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN")

elseif? Similar transformation as above.

+          set(CMAKE_Fortran_PLATFORM_ID "Cygwin")
+        endif()
+      endif()
+    endif()

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to