[CMake] cmake 2.8.3 forces -rdynamic for pf90 in pure fortran projects

Brad King brad.king at kitware.com
Mon Nov 22 12:12:51 EST 2010


On 11/22/2010 11:51 AM, Bill Hoffman wrote:
> On 11/22/2010 11:18 AM, Verweij, Arjen wrote:
>> -rdynamic is used for linking with pgf90 even though it is not
>> supported. The flag is imported from Linux-GNU.cmake and I guess it
>> is included because cmake (2.8.3) checks for C and C++ compilers by
>> default.
>>
>> http://www.vtk.org/Bug/view.php?id=9985 talks about this bug, but I'm
>> unsure what the final conclusion is and if the bug is considered
>> fixed. Even though this is a Fortran test, I can imagine it will
>> break linking multi-language code as well, if you mix PGI (pgf90)
>> with GNU (gcc/g++) and end up with -rdynamic because of it.
> 
> The bug says the problem is fixed.  Is that not what you are seeing?

It was a predecessor to this problem that was fixed.  Previously the
flag was always used on Linux no matter what.  Now it is a special case.

The problem is that CMakeFortranInformation.cmake defaults a bunch of
Fortran info variables to the values from C.  However, when the compiler
vendors are not the same this breaks things.  Really we need the compiler
info files for all languages to be independent and not assume anything.
Many of the current info files may have implicit dependencies caused by
this though so it will be difficult to remove the behavior.

Please try the patch below.

-Brad

diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index ef06acd..43e0232 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -22,4 +22,5 @@ macro(__linux_compiler_pgi lang)
   # Shared library compile and link flags.
   set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+  set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
 endmacro()


More information about the CMake mailing list