[cmake-developers] Linking projects with no C or CPP files

James Bigler jamesbigler at gmail.com
Thu Sep 12 16:45:33 EDT 2013


On Thu, Sep 12, 2013 at 1:32 PM, Brad King <brad.king at kitware.com> wrote:

> On 09/12/2013 03:08 PM, James Bigler wrote:
> > In 2.8.12 and 2.8.11.2 I noticed the following problem for VS 2012
> builds.
> > VS 2010 builds are fine.  Also CMake 2.8.10.1 works just fine.
> >
> > VS 2012 doesn't link the objects into a library.
> [snip]
> > Broken project:
> > <LinkObjects
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkObjects>
> >
> > In the working case this isn't in there at all.
>
> I suspect this change is related:
>
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b684b395
>
> It was added in 2.8.11 and is specific to VS >= 11.  It adds the
> LinkObjects element inside custom commands to tell VS not to link
> the custom command output by default.
>
> However, if the object has EXTERNAL_OBJECT set then there should
> be a separate <Object> entry for it that tells VS to link it in.
>
> -Brad
> --
>

I do set the EXTERNAL_OBJECT property.

      if( NOT compile_to_ptx )
        set_source_files_properties("${generated_file}"
          PROPERTIES
          EXTERNAL_OBJECT true # This is an object file not to be compiled,
but only be linked.
          )
      endif()

Now, to be clear, I don't actually add the object file to the build,
because VS would link in the output of the custom command when using the
MAIN_DEPENDENCY feature of the custom command.  Should I set this property
on the source file itself?

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130912/e2155bbd/attachment.html>


More information about the cmake-developers mailing list