@@ -9623,6 +9623,10 @@ Build Systems
it defaults to @code{"RelWithDebInfo"} (short for ``release mode with
debugging information''), which roughly means that code is compiled with
@code{-O2 -g}, as is the case for Autoconf-based packages by default.
+The @code{#:generator} parameter configures the native build system; it
+defaults to @code{"Unix Makefiles"} and can be changed to an alternative
+such as @code{Ninja} (the alternative generator must be available as
+both a module and native input).
@end defvar
@defvar composer-build-system
@@ -101,6 +101,7 @@ (define* (cmake-build name inputs
(search-paths '())
(make-flags ''())
(out-of-source? #t)
+ (generator "Unix Makefiles")
(build-type "RelWithDebInfo")
(tests? #t)
(test-target "test")
@@ -140,6 +141,7 @@ (define* (cmake-build name inputs
configure-flags)
#:make-flags #$make-flags
#:out-of-source? #$out-of-source?
+ #:generator #$generator
#:build-type #$build-type
#:tests? #$tests?
#:test-target #$test-target
@@ -177,6 +179,7 @@ (define* (cmake-cross-build name
(native-search-paths '())
(make-flags ''())
(out-of-source? #t)
+ (generator "Unix Makefiles")
(build-type "RelWithDebInfo")
(tests? #f) ; nothing can be done
(test-target "test")
@@ -231,6 +234,7 @@ (define* (cmake-cross-build name
#:configure-flags #$configure-flags
#:make-flags #$make-flags
#:out-of-source? #$out-of-source?
+ #:generator #$generator
#:build-type #$build-type
#:tests? #$tests?
#:test-target #$test-target
@@ -34,7 +34,7 @@ (define-module (guix build cmake-build-system)
;; Code:
(define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
- build-type target
+ build-type target generator
#:allow-other-keys)
"Configure the given package."
(let* ((out (assoc-ref outputs "out"))
@@ -50,6 +50,9 @@ (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
(format #t "build directory: ~s~%" (getcwd))
(let ((args `(,srcdir
+ ,@(if generator
+ (list (string-append "-G" generator))
+ '())
,@(if build-type
(list (string-append "-DCMAKE_BUILD_TYPE="
build-type))