0

I have mac os CMake project where I'm trying to bundle a Wavefront text .obj files into the resources of the application (https://en.wikipedia.org/wiki/Wavefront_.obj_file): the content is irrelevant, but just happens that the standard extension for that format is .obj.

Now, If I name the files something.obj_ I get everything working properly, so this is not a "mac question". But I want to keep original extension .obj. What I want to achieve is that my target executable has also a dependency on the .obj resource file, since a change on the resource should recreate the bundle with the new file. My problem is that any dependency on a file named .obj gets it interpreted as a code object and the linker just issues the errors:

ld: warning: ignoring file ../../assets/file.obj, file was built for unsupported file format ( 0x23 0x20 0x42 0x6C 0x65 0x6E 0x64 0x65 0x72 0x20 0x76 0x32 0x2E 0x37 0x39 0x20 ) which is not the architecture being linked (x86_64): ../../assets/file.obj

From what I see, any other files that are on the same directory with "unknown" extensions such as .mtl are copied correctly, but this .obj file must be some triggering some rule associated with linker.

How can I get cmake to simply handle the file as a "text file to copy" independently if it was called .obj, .cpp or .o ?

1 Answer 1

1

I think I found the solution to my own question:

set_source_files_properties(${ASSET_FILES} PROPERTIES HEADER_FILE_ONLY ON ) 

This will pass ASSET_FILES through the linker without a problem

Sign up to request clarification or add additional context in comments.

1 Comment

You wonderful wonderful stranger.