Link Fortran executable with C library using CommandLineTools C compiler on Mac OSX

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Link Fortran executable with C library using CommandLineTools C compiler on Mac OSX

Algiane Froehly
Hi,

I am trying to link a fotran program with a C library on Mac.

Using the gcc compiler it works perfectly but if I use the commandLineTools compiler, I end up with an error at linking. It happens with both gfortran and pgf90 (not ifort).
I can build manually my executable if I remove the -lto_library library that is added by the CMAKE_C_IMPLICIT_LINK_LIBRARIES variable.

What can I do to make it work automatically (I have found a post saying that it is not possible to overwrite the CMAKE_C_IMPLICIT_LINK_LIBRARIES variable)?

Is it normal that gfortran and pgf90 adds the link to the to_library and not ifort?

Thank you for your help,

Regards,

Algiane Froehly.



--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Link Fortran executable with C library using CommandLineTools C compiler on Mac OSX

Brad King
On 04/11/2017 05:31 AM, Algiane Froehly wrote:
> if I remove the -lto_library library that is added by the
> CMAKE_C_IMPLICIT_LINK_LIBRARIES variable.

See here:

* https://gitlab.kitware.com/cmake/cmake/merge_requests/658
* https://gitlab.kitware.com/cmake/cmake/issues/16766

It is fixed in CMake 3.8.0.

-Brad

--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Link Fortran executable with C library using CommandLineTools C compiler on Mac OSX

Algiane Froehly
Hi,

I haven’t seen this posts, it works perfectly now.

Thank you for your help.

Regards,

Algiane

> Le 13 avr. 2017 à 12:52, Brad King <[hidden email]> a écrit :
>
> On 04/11/2017 05:31 AM, Algiane Froehly wrote:
>> if I remove the -lto_library library that is added by the
>> CMAKE_C_IMPLICIT_LINK_LIBRARIES variable.
>
> See here:
>
> * https://gitlab.kitware.com/cmake/cmake/merge_requests/658
> * https://gitlab.kitware.com/cmake/cmake/issues/16766
>
> It is fixed in CMake 3.8.0.
>
> -Brad
>

--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...