[Cmake] nasm and cmake

Lars Prieske prieske at planet.de
Fri Feb 7 12:21:15 EST 2003


Hi Andy,
ok, the build step for assembler files works fine. Now, i have to link the
'assembler objects' into a library together with normal 'c/cpp objects'. This
library is creating by ADD_LIBRARY(libname ${LIB_SOURCES}). How can i add my
own object files into link process?

On 07-Feb-2003 Andy Cedilnik wrote:
> Hi Lars,
> 
> Easy... (CMake 1.6)
> 
> Here is how you do a generic build step for tool "tool" which takes
> source "source" and produces result file "result":
> 
> ADD_CUSTOM_TARGET(result_TARGET ALL)
> 
># One per source
> ADD_CUSTOM_COMMAND(SOURCE source
>                    COMMAND tool
>                    ARGS --arguments-for-tool 
>                         --source source --result result
>                    OUTPUTS result
>                    TARGET result_TARGET)
> 
># One for all sources
> ADD_CUSTOM_COMMAND(SOURCE result_TARGET
>                    DEPENDS result
>                    TARGET result_TARGET)
> 
> Replace source with your source file, replace result with your object
> file I guess, replace tool with nasm and --arguments-for-tool --source
> source --result result with apropriate flags.
> 
> If you have multiple source, you need one custom command per source, but
> the second one is only one. Make sure to list all the results in the
> second one.
> 
> If you have another step, let say linking:
> 
> ADD_CUSTOM_TARGET(result_TARGET ALL)
> 
># One per source
> ADD_CUSTOM_COMMAND(SOURCE source
>                    COMMAND tool
>                    ARGS --arguments-for-tool 
>                         --source source --result result
>                    OUTPUTS result
>                    TARGET result_TARGET)
> 
># One per link line
> ADD_CUSTOM_COMMAND(SOURCE result
>                    COMMAND link-tool
>                    ARGS --arguments-for-link-tool 
>                         --source result --result link-result
>                    OUTPUTS lin-result
>                    TARGET result_TARGET)
> 
># One for all sources
> ADD_CUSTOM_COMMAND(SOURCE result_TARGET
>                    DEPENDS link-result
>                    TARGET result_TARGET)
> 
> 
> You get the picture.
> If you want to support out of source build, make sure to put
> ${CMAKE_CURRENT_SOURCE_DIR} prefix in front of every source file and
> ${CMAKE_CURRENT_BINARY_DIR} prefix in fron of every binary file. 
> 
>                               Andy
> 
> On Fri, 2003-02-07 at 11:22, Lars Prieske wrote:
>> Hello,
>> has everyone implemented a cmake makro to handle nasm files (name.asm)? I'm
>> looking for a solution to make a library from assembler and cpp code.
> 
> 

Gruß

Lars

-----------------------------------------------------------------------
 Lars Prieske * Planet AG * Residence Park 1-7 * 19065 Raben Steinfeld
E-Mail: prieske at planet.de * Tel:+49-385-3030-380 * Fax:+49-385-3030-250
keine Werbung ****************************************** no advertising
-----------------------------------------------------------------------




More information about the CMake mailing list