Object Files

Hi

I am trying to add google test to an existing project.

My test project needs to link against a file called Settings.obj which is an artifact of another project.

This a multi config visual studio application.

I have added this lines to include the Debug version

SET(OBJS

${CMAKE_HOME_DIRECTORY}/build/apps/Conifer/SeaLink.dir/Debug/Settings.obj

)

And the tell Cmake that they a generated

SET_SOURCE_FILES_PROPERTIES(

${OBJS}

PROPERTIES

EXTERNAL_OBJECT true

GENERATED true

)

Now this works but I need it to work for Release as well.

If I add the line

${CMAKE_HOME_DIRECTORY}/build/apps/Conifer/SeaLink.dir/Release/Settings.obj

Then generate the build tree the build fails as the Release/Settings.obj file is not found.

Is there a way around this?

Thanks

I guess the short time answer should be :

SET(OBJS ${CMAKE_HOME_DIRECTORY}/build/apps/Conifer/SeaLink.dir/$<CONFIG>/Settings.obj)
See the generator expressions.

Else, your code is dirty because your hard-coded paths. You should review your CMake project.

PS: Please format your code samples.

Thanks, I’ll check them out.