[CMake] Mixed Fortran and C sources with Visual Studio 10

Brian Wainscott brian at lstc.com
Tue Oct 22 11:04:45 EDT 2013


Arjen,

Thanks -- that was more or less what I understood also.  And I was thinking about
that approach, but frankly just expected that if that was a limitation of VS, and
cmake builds for VS, then cmake should do that for me.  I'm just surprised it
doesn't, and was hoping someone would know of a simple way to tell cmake to build
two separate project files for me.

So I guess I'll look into that, and also nmake.

Thanks,

Brian

On 10/21/2013 09:29 PM, Arjen Markus wrote:
> Hi Brian,
>
> as I understand it, it is an explicit limitation of Visual Studio that a VS project can only contain
> a single programming language. The solution to this would to split the sources into separate lists and
> build libraries from them.
>
> An alternative might be to use the Nmake approach - that is, use plain makefiles instead
> of Visual Studio to build the project.
>
> Regards,
>
> Arjen
>
>> -----Original Message-----
>> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
>> Of Brian Wainscott
>> Sent: Tuesday, October 22, 2013 12:50 AM
>> To: cmake at cmake.org
>> Subject: [CMake] Mixed Fortran and C sources with Visual Studio 10
>>
>> I'm trying to convert a large(ish) project to cmake.  Everything works fine in Linux, but
>> I'm having problems on Windows.
>>
>> Specifically, we have both C and Fortran sources mixed together in a single directory.
>> Cmake is producing an vcxproj file and none of the Fortran code gets compiled.
>>
>> I've been informed that I probably need two project files, one for C and one for
>> Fortran (vfproj).  OK -- so why does cmake not then produce two project files?
>> Am I missing a flag or setting somewhere?
>>
>> As a concrete test, I tried this for a CMakeLists.txt file:
>>
>> enable_language(Fortran)
>> enable_language(C)
>> add_executable(tst tst.F cfunc.c)
>>
>> with a trivial Fortran main and C subroutine.  It builds fine in Linux, but not on
>> Windows.
>>
>> Everything works so well in Linux that I have a hard time believing that anything
>> complex should be required for Windows -- I must be missing something simple but
>> can't find any information on what it might be.
>>
>> Any suggestions on how to get this to work?
>>
>> I'm using cmake 2.8.11.2 with VS 10 and my Fortran compiler is Intel Composer XE
>> 2013.
>>
>> Thanks,
>>
>> Brian
>> --
>>
>> 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://www.cmake.org/mailman/listinfo/cmake
> DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail.



More information about the CMake mailing list