summaryrefslogtreecommitdiffstats
path: root/Tests/Fortran
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-26 15:32:19 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-26 15:32:19 (GMT)
commit7b10ec686f9a9400c7aaac649765c2332f2a2085 (patch)
tree8e0d16b28978d24b1b7a8301a8baa1cef5a640df /Tests/Fortran
parent707d05e9368f53707b23d565967c996878db27d2 (diff)
downloadCMake-7b10ec686f9a9400c7aaac649765c2332f2a2085.zip
CMake-7b10ec686f9a9400c7aaac649765c2332f2a2085.tar.gz
CMake-7b10ec686f9a9400c7aaac649765c2332f2a2085.tar.bz2
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.
Diffstat (limited to 'Tests/Fortran')
-rw-r--r--Tests/Fortran/CMakeLists.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 01c115b..709ea5f 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -8,8 +8,22 @@ message("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}")
message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}")
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_library(world ${_SHARED} world.f world.def)
add_executable(testf testf.f)
target_link_libraries(testf hello world)