[CMake] How to link the output of a custom command (VS2013) when the output is an obj file, since LinkObjects is hardcoded to false?

Nick Georghiou ngeorghiou at iprimus.com.au
Wed Sep 2 03:21:11 EDT 2015


Hi,

 

I have the custom command provided below which successfully creates
mydll.obj in the correct intermediate directory. However the LinkObjects
property of the custom command within Visual Studio 2013 is set to false and
therefore the object file is not linked. Upon inspection of the CMake code,
it seems that the LinkObjects property is hardcoded to false and there is no
cmake option to specify otherwise.

 

Is there another way to get the object file to link that I am missing. Any
help on this would be greatly appreciated.

 

---

 

My custom command:

 

add_custom_command(

    OUTPUT "$(IntDir)mydll.obj" 

    COMMAND ml64.exe /c /nologo /Fo"$(IntDir)mydll.obj" /Zi "%(FullPath)" 

    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/mydll.asm)

 

---

 

CMake code in file cmVisualStudio10TargetGenerator.cxx:

 

    if(this->LocalGenerator->GetVersion()

                                        >
cmGlobalVisualStudioGenerator::VS10)

      {

      // VS >= 11 let us turn off linking of custom command outputs.

      this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3);

      (*this->BuildFileStream ) << "false</LinkObjects>\n";

      }

    }

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150902/31997394/attachment.html>


More information about the CMake mailing list