[CMake] One library with multiple sub-directories
Bradley Lowekamp
blowekamp at mail.nih.gov
Tue Nov 2 15:55:24 EST 2004
I have a good bit of stuff, going on in the sub directories. If I just
pass relative paths to the ADD_LIBRARY command then it should still
work even with SUBDIRS? Well I am in the mists of looking up some
string editing to try that out now, lets hope this works.
Thanks,
Brad
On Nov 2, 2004, at 3:28 PM, Brad King wrote:
> Bradley Lowekamp wrote:
>> Hello,
>> I am trying to generate a single library from multiple source
>> sub-directories where in the subdirectories files may have the same
>> name. Currently I have been making sure that each file had different
>> names, but I can't be doing this any more. The way I have it
>> currently set up is basically as follows:
>> directory structure:
>> /-
>> -/foo
>> default.cpp
>> -/bar
>> default.cpp
>> top level cmake:
>> SUBDIRS( foo)
>> SUBDIRS(bar)
>> SET (MY_LIB_SRC ${FOO_SRC} ${BAR_SRC})
>> ADD_LIBRARIES(my ${MY_LIB_SRC}
>
> Just leave out the SUBDIRS and build it all from the top:
>
> ADD_LIBRARIES(my foo/default.cpp bar/default.cpp)
>
> The object files will be built with the proper relative paths.
>
> -Brad
>
>
========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov
More information about the CMake
mailing list