[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.35 1.36

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 26 11:32:22 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/Fortran
In directory public:/mounts/ram/cvs-serv3680/Tests/Fortran

Modified Files:
	CMakeLists.txt 
Log Message:
Skip SHARED lib Fortran test with XL and old GNU

The commit "Test all target types in Fortran" enabled a SHARED library
in the Fortran test.  However, we do not yet implement support for
shared libraries with XL Fortran (it seems this requires using the C
compiler to link).  Furthermore, the old g77 2.97 from Red Hat does not
support shared libs on Itanium because the g2c lib is not -fPIC.

For now we just disable SHARED libs in the test for these tools.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Fortran/CMakeLists.txt,v
retrieving revision 1.35
retrieving revision 1.36
diff -C 2 -d -r1.35 -r1.36
*** CMakeLists.txt	26 Oct 2009 15:07:23 -0000	1.35
--- CMakeLists.txt	26 Oct 2009 15:32:19 -0000	1.36
***************
*** 9,14 ****
  message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
  
  add_library(hello STATIC hello.f)
! add_library(world SHARED world.f world.def)
  add_executable(testf testf.f)
  target_link_libraries(testf hello world)
--- 9,28 ----
  message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
  
+ set(_SHARED SHARED)
+ if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(XL|VisualAge)$")
+   # We do not implement SHARED Fortran libs on AIX yet!
+   # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits.
+   set(_SHARED STATIC)
+ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
+   # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC
+   execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version
+                   OUTPUT_VARIABLE output ERROR_VARIABLE output)
+   if("${output}" MATCHES "Red Hat .* 2\\.96")
+     set(_SHARED STATIC)
+   endif()
+ endif()
+ 
  add_library(hello STATIC hello.f)
! add_library(world ${_SHARED} world.f world.def)
  add_executable(testf testf.f)
  target_link_libraries(testf hello world)



More information about the Cmake-commits mailing list