[CMake] Windows .rc resource files in Fortran projects?

Volker Enderlein volker.enderlein at ifm-chemnitz.de
Fri Nov 16 05:07:38 EST 2018


Hi Magne,

it looks like this is a common issue with fortran projects.

See 
https://www.reddit.com/r/cmake/comments/5tzziu/building_fortran_application_with_resources/ 
for a solution.

Cheers, Volker

Am 16.11.2018 um 09:08 schrieb Magne Rudshaug:
> Hi Volker,
>
> Thanks for your reply! I now have these lines in the top of my CMakeLists.txt file.
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
>
> PROJECT(ALICE LANGUAGES C CXX Fortran RC)
>
> INCLUDE("${ALICE_SOURCE_DIR}/cmake_conf/ALICE.cmake")
>
> ADD_SUBDIRECTORY("ALCEL3_BEREGN")
> ADD_SUBDIRECTORY("ALCEL3_DISPLAY_PROTO")
> ADD_SUBDIRECTORY("ALCEL3_INPUT")
> ADD_SUBDIRECTORY("ALCEL3_OUTPUT")
> ADD_SUBDIRECTORY("ALCEL3_PROTO_PRINT")
> ADD_SUBDIRECTORY("ALFLU_MESH")
> ADD_SUBDIRECTORY("ALFLU_MESH_NEW")
>
> I get exactly the same behaviour, the Fortran projects that has a .rc file associated are interpreted as a C/CXX project. Once I remove this it is interpreted correctly as a Fortran project.
>
> Magne
>
> Magne Rudshaug, Ph.D. | Principal Scientist | Computational Materials Processing
> Institute for Energy Technology | www.ife.no |+47 481 77 495
>
>
> -----Original Message-----
> From: Volker Enderlein [mailto:volker.enderlein at ifm-chemnitz.de]
> Sent: 15. november 2018 18:39
> To: Magne Rudshaug
> Subject: Re: [CMake] Windows .rc resource files in Fortran projects?
>
> Hi Magne,
>
> AFAIK C and CXX are enabled by default if you do not specify a LANGUAGES
> argument in the project command. You only **added** a language with
> ENABLE_LANGUAGE.
>
> BTW, you should move the cmake_minimum_required command to the top of
> the file as it influences the setup inside of the project command.
>
> Cheers, Volker
>
> Am 15.11.2018 um 16:03 schrieb Magne Rudshaug:
>> Hi Volker,
>>
>> Thanks for reply! The top of mine looks like:
>>
>> PROJECT(ALICE)
>>
>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
>>
>> ENABLE_LANGUAGE(Fortran)
>>
>> Isn't this equivalent to what you wrote? If I remove the .rc file from the list of files. The project becomes a Fortran project again. But, then the .rc file is ignored, and that is not what I want.
>>
>> -----Original Message-----
>> From: CMake <cmake-bounces at cmake.org> On Behalf Of Volker Enderlein
>> Sent: torsdag 15. november 2018 15:23
>> To: cmake at cmake.org
>> Subject: Re: [CMake] Windows .rc resource files in Fortran projects?
>>
>> Hi,
>>
>> how does the project command looks inside your CMakeLists.txt file?
>>
>> project(<name> LANGUAGES Fortran) should work
>>
>> Cheers Volker
>>
>> Am 15.11.2018 um 14:35 schrieb Magne Rudshaug:
>>> Hi,
>>>
>>> In some of my Fortran projects I have Windows resource files of type
>>> .rc associated. Just listing this file along with the other Fortran
>>> source files doesn't work.
>>>
>>> In this case the project is interpreted as a C/C++ project. How can I
>>> get cmake to treat the .rc file correctly (compiled by the resource
>>> compiler) and at the same
>>>
>>> time interpret the project as a Fortran project?
>>>
>>> Thanks in advance for any reply?
>>>
>>> Magne
>>>
>>>



More information about the CMake mailing list