diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2011-12-16 22:01:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-02-09 13:35:56 (GMT) |
commit | bd69e1c567cc4fc1bf30d321d888dd2567d82e7a (patch) | |
tree | 728f58828a83bd8be273b4de37939eaba58d44ef /Tests/VSGNUFortran | |
parent | 414a780d1c22339e924ea3d880e54482f0d67898 (diff) | |
download | CMake-bd69e1c567cc4fc1bf30d321d888dd2567d82e7a.zip CMake-bd69e1c567cc4fc1bf30d321d888dd2567d82e7a.tar.gz CMake-bd69e1c567cc4fc1bf30d321d888dd2567d82e7a.tar.bz2 |
VSGNUFortran: Add special case for SunPro Fortran runtime library
The SunPro compiler does not add the fortran runtime library when
creating a shared fortran library. Link to the SunPro Fortran runtime
libraries explicitly.
Diffstat (limited to 'Tests/VSGNUFortran')
-rw-r--r-- | Tests/VSGNUFortran/fortran/CMakeLists.txt | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Tests/VSGNUFortran/fortran/CMakeLists.txt b/Tests/VSGNUFortran/fortran/CMakeLists.txt index ff22993..3ee1855 100644 --- a/Tests/VSGNUFortran/fortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/fortran/CMakeLists.txt @@ -1,12 +1,46 @@ cmake_minimum_required(VERSION 2.8) project(FortranHello Fortran C) +# add a function to test for -lsunquad on sunpro sun systems. +function(test_sunquad result) + set( TEST_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/sunq") + file(WRITE "${TEST_DIR}/testsunq.f" " + PROGRAM TEST + END + ") + file(WRITE ${TEST_DIR}/CMakeLists.txt " +project(sunq Fortran) +add_library(sunq SHARED testsunq.f) +target_link_libraries(sunq sunquad) +") + message(STATUS "looking for -lsunquad") + try_compile(RESULT "${TEST_DIR}" "${TEST_DIR}" sunq OUTPUT_VARIABLE OUT) + if("${RESULT}") + message(STATUS "-lsunquad found") + else() + message(STATUS "-lsunquad not found") + endif() + message(STATUS + "looking for sunquad:\nRESULT=[${RESULT}]\nOUTPUT=[\n${OUT}\n]") + set(${result} "${RESULT}" PARENT_SCOPE) +endfunction() + +# check for the fortran c interface mangling include(FortranCInterface) FortranCInterface_HEADER(HelloWorldFCMangle.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_" SYMBOLS hello world) - add_library(hello SHARED hello.f) add_library(world SHARED world.f) target_link_libraries(hello world) +if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) + target_link_libraries(hello fsu) + if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) + target_link_libraries(hello sunmath m) + test_sunquad(CMAKE_HAS_SUNQUAD) + if(CMAKE_HAS_SUNQUAD) + target_link_libraries(hello sunquad) + endif() + endif() +endif() |