When building a shared library using the NAG Fortran compiler, cmake is invoking<div>the compiler with the &quot;-fPIC&quot; option.  This is wrong.  The correct option is &quot;-PIC&quot;.</div><div>I&#39;ve found I can get things to work if I add the following two lines to my CMakeLists.txt</div>
<div>file (probably not the right way to fix things):</div><div><br></div><div><div>set(CMAKE_Fortran_COMPILE_OPTIONS_PIC &quot;-PIC&quot;)</div><div>set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS &quot;-PIC&quot;)</div></div><div>
<br></div><div>Several questions (I&#39;m *very* new to cmake, so apologies if they&#39;re stupid):</div><div>1)  I&#39;ve found the file Modules/Platform/Linux-NAG-Fortran.cmake.  Is that where</div><div>    compiler-specific settings like this belong?   And are the above two lines the</div>
<div>    correct thing to add to that file?</div><div>2) Is there a maintainer for the Fortran (esp. NAG) related module files?  I suspect</div><div>    that there are other areas where cmake will not drive the NAG compiler correctly.</div>
<div>3) Until this is fixed in cmake, I need to find a robust way of making this work.  the</div><div>    problem with what I did above is that I only want to set the variables if I&#39;m using</div><div>    the NAG compiler.  Is there some cmake variable available that gives the identity</div>
<div>    of the Fortran compiler it identified against which I can test?  Or can my code</div><div>    distribution include a &quot;fixed&quot; version of Linux-NAG-Fortran.cmake (assuming it&#39;s the</div><div>    culprit) that somehow gets used instead?  What are the standard strategies</div>
<div>    in cases like this?</div><div><br></div><div>Thanks for your help!</div>