[CMake] Library with source in multiple sub-directories

Mr David McKinnon s341552 at student.uq.edu.au
Fri Jun 17 03:56:37 EDT 2005


Hi,
  I have a fairly simple question that in my initial attempts I have not
been able solve sufficiently.

  I would like to build a library with the ADD_LIBRARY command from a
set of source files that span multiple sub-directories. I am creating a
list of the source files using the SET command in each of the
sub-directories (SET(source1 ...)) then trying to append all the sources
together in the top-level directory as follows SET(all_source ${source1}
${source2} ...) and using these as follows ADD_LIBRARY(a_library
${all_source}) but the result is that non of the source files from
${source1} etc. appear in the source file list in ${all_source}.

  Is this right approach to this type of library building? Am I missing
something on the lower directory levels that does not permit the source
file information to be passed to the higher levels.

Thanks,
David McKinnon...


More information about the CMake mailing list