Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake and Visual Studio resource files

I am converting a C++ project created using Visual Studio 2005 to CMake and have stumbled upon a bit of a problem with resource files that are included in the project.

The project includes a .rc file, a bunch of .ico files and a .rc2 file.

The regular .rc file works fine in the generated project and uses the resource compiler. The .ico and .rc2 files however are causing problems when they are just being included, because in the generated project Visual Studio attempts to compile them using the C/C++ compiler.

I assume that these files are included by the .rc file, so it would probably work to just not include them in the CMakeLists.txt file, but since it is obviously possible to list them in the project (they are visible in the original project) I would like to do so, so that the user of the generated project can see that these files are being used.

What is the correct way to handle these extra VS resource files in CMake?

like image 472
villintehaspam Avatar asked Nov 18 '11 13:11

villintehaspam


1 Answers

Try to set_source_files_properties(your.ico your.rc2 PROPERTIES LANGUAGE RC).

like image 55
arrowd Avatar answered Oct 24 '22 07:10

arrowd