CMake Proposal

Stefan (metze) Metzmacher metze at samba.org
Tue Feb 23 01:24:47 MST 2010


Bill Hoffman schrieb:
> Hi,
> 
> Dan Shearer asked me to join the discussion about Samba using CMake as a
> build system.  I am a CMake developer, and of course would be very happy
> if Samba were to adopt CMake as a build tool.
> 
> I have read the thread on this list and would like to address some of
> the questions that came up.
> 
> -  command line interface to CMake and -Dvar=value is verbose

I think the most important missing piece is './configure --help'.

cmake -LH shows something is much less verbose and also
needs to run all the configure tests before displaying anything.


One reason for starting our custom build system to prevent/notice
user errors (e.g. typos and impossible dependecies).
Dependencies should be specified only in one place
and the build system should give an error on typos.
(I know with the current s4 build system this isn't true anymore
 for all cases)

With CMake a user needs to specify the dependencies multiple times
and doesn't notice typos.

 # define include dirs and the library for later use and cache it.
 set(LIBTEVENT_PUBLIC_INCLUDE_DIRS
-    ${TALLOC_INCLUDE_DIRS}
+    ${LIBTALLOC_INCLUDE_DIRS}
     ${LIBTEVENT_SOURCE_DIR}
     CACHE INTERNAL "libreplace public include directories"
 )

 add_library(${LIBTEVENT_LIBRARY} SHARED ${tevent_SRCS})
-target_link_libraries(${LIBTEVENT_LIBRARY} ${LIBREPLACE_LIBRARY}
${TALLOC_LIBARIES})
+target_link_libraries(${LIBTEVENT_LIBRARY} ${LIBREPLACE_LIBRARY}
${LIBTALLOC_LIBRARY})

Please take a look at
http://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master4-gladiac-cmake
for the whole patch.

Is there a way to warn about uninitialized variables?

It was also bad that libtevent.so was linked fine, while
it had unresolved symbols (it wasn't linked to the libtalloc.so,
because of the typos).

Maybe helper functions could make it easier to specifiy dependencies
just once and have only unique dependencies calculated?

By unique dependecies I mean:
- Binary FOO depends on subsystems X,Y,Z
- X and Y depend on A.
- FOO should link in A,X,Y,Z (and each only once!)

The reason for only once is that we pre-link mutliple object files
into a single object file (MERGED_OBJECT). This is needed on some
platforms as the cmdline arguments are limited to 1024.
Using static libraries (.a files) is bad as that would allow
the linker to optimize out symbols which aren't used by the binary,
but need to be there for loaded .so modules at runtime.

Also the tevent build should not install the talloc library,
but I assume that is easy fixable.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100223/305d65af/attachment.pgp>


More information about the samba-technical mailing list