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

Hendrik Sattler post at hendrik-sattler.de
Wed Sep 2 06:13:18 EDT 2015


Hi,

why don't you just add the asm file to your add_library() call and enable the ASM language?

HS


Am 2. September 2015 09:21:11 MESZ, schrieb Nick Georghiou <ngeorghiou at iprimus.com.au>:
>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";
>
>      }
>
>    }
>
> 
>
> 
>
>
>
>------------------------------------------------------------------------
>
>-- 
>
>Powered by www.kitware.com
>
>Please keep messages on-topic and check the CMake FAQ at:
>http://www.cmake.org/Wiki/CMake_FAQ
>
>Kitware offers various services to support the CMake community. For
>more information on each offering, please visit:
>
>CMake Support: http://cmake.org/cmake/help/support.html
>CMake Consulting: http://cmake.org/cmake/help/consulting.html
>CMake Training Courses: http://cmake.org/cmake/help/training.html
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150902/336a028c/attachment.html>


More information about the CMake mailing list