List Info

Thread: compiling a single .cpp file?




compiling a single .cpp file?
country flaguser name
Denmark
2007-08-30 01:27:53
Hi all,

Often I only want to compile a single .cpp file I'm working
on.
Thus I could add a Jamfile with an obj target for each .cpp
file in my 
project. This seems a bit anoying. Is there a way to auto
generate a 
target (perhaps having the same name as the .cpp file
without it's 
extension)?

Thanks in advance

-Thorsten
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: compiling a single .cpp file?
user name
2007-08-30 08:10:40
Thorsten Ottosen wrote:
> Hi all,
>
> Often I only want to compile a single .cpp file I'm
working on.
> Thus I could add a Jamfile with an obj target for each
.cpp file in my 
> project. This seems a bit anoying. Is there a way to
auto generate a 
> target (perhaps having the same name as the .cpp file
without it's 
> extension)?
>
> Thanks in advance
>
> -Thorsten

You'll have to have a "project" target with the
build requirements to
make sure that everything is built the same or give the same
build
requirements to the "obj" and "lib" (or
whatever is building the target
that uses the source files).  In the example below, you
would either
remove the "project" line or the
"$(build_requirements)" from the "obj"
and "lib" lines.

    project foo : build-requirements $(build_requirements)
;

    local source = [ glob *.cpp ] ;
    for local s in $(source)  {
        obj $(s:B) : $(s) : $(build_requirements) ;
    }

    lib foo : $(source) : $(build_requirements) ;


Is there a reason you don't want to use my suggestion of
"bjam
foo_src.obj" with msvc and "bjam foo_src.o"
in most (all?) other cases? 
That's how I recompile a single file (or even several files)
when I'm
working on a header that affects lots of files. 

HTH,

Phillip
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: compiling a single .cpp file?
country flaguser name
Denmark
2007-09-05 03:17:30
Phillip Seaver skrev:

 >     project foo : build-requirements
$(build_requirements) ;
 >
 >     local source = [ glob *.cpp ] ;
 >     for local s in $(source)  {
 >         obj $(s:B) : $(s) : $(build_requirements) ;
 >     }
 >
 >     lib foo : $(source) : $(build_requirements) ;
 >
 >
 > Is there a reason you don't want to use my suggestion
of "bjam
 > foo_src.obj" with msvc and "bjam
foo_src.o" in most (all?) other cases?

no. Your code works beutifully.

Thanks

-Thorsten
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )