When building a shared library using the NAG Fortran compiler, cmake is
invoking
the compiler with the "-fPIC" option.  This is wrong.  The correct option
is "-PIC".
I've found I can get things to work if I add the following two lines to my
CMakeLists.txt
file (probably not the right way to fix things):

set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")

Several questions (I'm *very* new to cmake, so apologies if they're stupid):
1)  I've found the file Modules/Platform/Linux-NAG-Fortran.cmake.  Is that
where
    compiler-specific settings like this belong?   And are the above two
lines the
    correct thing to add to that file?
2) Is there a maintainer for the Fortran (esp. NAG) related module files?
 I suspect
    that there are other areas where cmake will not drive the NAG compiler
correctly.
3) Until this is fixed in cmake, I need to find a robust way of making this
work.  the
    problem with what I did above is that I only want to set the variables
if I'm using
    the NAG compiler.  Is there some cmake variable available that gives
the identity
    of the Fortran compiler it identified against which I can test?  Or can
my code
    distribution include a "fixed" version of Linux-NAG-Fortran.cmake
(assuming it's the
    culprit) that somehow gets used instead?  What are the standard
strategies
    in cases like this?

Thanks for your help!
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to