Mon Nov 20 09:51:48 2023 UTC ()
cmake/build.mk: Fix subdirectory builds.


(nia)
diff -r1.10 -r1.11 pkgsrc/devel/cmake/build.mk

cvs diff -r1.10 -r1.11 pkgsrc/devel/cmake/build.mk (expand / switch to unified diff)

--- pkgsrc/devel/cmake/build.mk 2023/10/09 17:19:30 1.10
+++ pkgsrc/devel/cmake/build.mk 2023/11/20 09:51:48 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: build.mk,v 1.10 2023/10/09 17:19:30 adam Exp $ 1# $NetBSD: build.mk,v 1.11 2023/11/20 09:51:48 nia Exp $
2# 2#
3# This Makefile fragment supports building using the CMake build tool. 3# This Makefile fragment supports building using the CMake build tool.
4# 4#
5# User-settable variables: 5# User-settable variables:
6# 6#
7# CMAKE_GENERATOR 7# CMAKE_GENERATOR
8# Which build tool to use. 8# Which build tool to use.
9# 9#
10# Possible: make ninja 10# Possible: make ninja
11# Default: make 11# Default: make
12# 12#
13# Package-settable variables: 13# Package-settable variables:
14# 14#
@@ -71,55 +71,54 @@ INSTALL_DIRS?= ${CONFIGURE_DIR} @@ -71,55 +71,54 @@ INSTALL_DIRS?= ${CONFIGURE_DIR}
71 71
72_CMAKE_CONFIGURE_SETTINGS= yes 72_CMAKE_CONFIGURE_SETTINGS= yes
73 73
74.PHONY: cmake-configure cmake-build cmake-test cmake-install 74.PHONY: cmake-configure cmake-build cmake-test cmake-install
75 75
76.if !target(do-configure) 76.if !target(do-configure)
77do-configure: cmake-configure 77do-configure: cmake-configure
78cmake-configure: 78cmake-configure:
79 ${RUN} cd ${WRKSRC}/${CONFIGURE_DIR} && \ 79 ${RUN} cd ${WRKSRC}/${CONFIGURE_DIR} && \
80 ${SETENV} ${CONFIGURE_ENV} cmake \ 80 ${SETENV} ${CONFIGURE_ENV} cmake \
81 --install-prefix ${PREFIX} \ 81 --install-prefix ${PREFIX} \
82 -B ${CMAKE_BUILD_DIR} \ 82 -B ${CMAKE_BUILD_DIR} \
83 -G ${_CMAKE_BUILD_SYSTEM:Q} \ 83 -G ${_CMAKE_BUILD_SYSTEM:Q} \
84 ${CMAKE_CONFIGURE_ARGS} \ 84 ${CMAKE_CONFIGURE_ARGS}
85 ${WRKSRC} 
86.endif 85.endif
87 86
88.if !target(do-build) 87.if !target(do-build)
89do-build: cmake-build 88do-build: cmake-build
90cmake-build: 89cmake-build:
91. for d in ${BUILD_DIRS} 90. for d in ${BUILD_DIRS}
92 ${RUN} cd ${WRKSRC}/${CMAKE_BUILD_DIR}/${d} && \ 91 ${RUN} cd ${WRKSRC}/${d}/${CMAKE_BUILD_DIR} && \
93 ${SETENV} ${MAKE_ENV} \ 92 ${SETENV} ${MAKE_ENV} \
94 ${_CMAKE_BUILD_TOOL} ${CMAKE_BUILD_ARGS} ${BUILD_TARGET} 93 ${_CMAKE_BUILD_TOOL} ${CMAKE_BUILD_ARGS} ${BUILD_TARGET}
95. endfor 94. endfor
96.endif 95.endif
97 96
98.if !target(do-test) 97.if !target(do-test)
99do-test: cmake-test 98do-test: cmake-test
100cmake-test: 99cmake-test:
101. for d in ${TEST_DIRS} 100. for d in ${TEST_DIRS}
102 ${RUN} cd ${WRKSRC}/${CMAKE_BUILD_DIR}/${d} && \ 101 ${RUN} cd ${WRKSRC}/${d}/${CMAKE_BUILD_DIR} && \
103 ${SETENV} ${TEST_ENV} \ 102 ${SETENV} ${TEST_ENV} \
104 ${_CMAKE_BUILD_TOOL} ${CMAKE_BUILD_ARGS} ${TEST_TARGET} 103 ${_CMAKE_BUILD_TOOL} ${CMAKE_BUILD_ARGS} ${TEST_TARGET}
105. endfor 104. endfor
106.endif 105.endif
107 106
108.if !target(do-install) 107.if !target(do-install)
109do-install: cmake-install 108do-install: cmake-install
110cmake-install: 109cmake-install:
111. for d in ${INSTALL_DIRS} 110. for d in ${INSTALL_DIRS}
112 ${RUN} cd ${WRKSRC}/${CMAKE_BUILD_DIR}/${d} && \ 111 ${RUN} cd ${WRKSRC}/${d}/${CMAKE_BUILD_DIR} && \
113 ${SETENV} ${INSTALL_ENV} \ 112 ${SETENV} ${INSTALL_ENV} \
114 ${_CMAKE_BUILD_TOOL} ${CMAKE_INSTALL_ARGS} ${INSTALL_TARGET} 113 ${_CMAKE_BUILD_TOOL} ${CMAKE_INSTALL_ARGS} ${INSTALL_TARGET}
115. endfor 114. endfor
116.endif 115.endif
117 116
118_VARGROUPS+= cmake 117_VARGROUPS+= cmake
119_USER_VARS.cmake+= CMAKE_GENERATOR 118_USER_VARS.cmake+= CMAKE_GENERATOR
120_PKG_VARS.cmake+= CMAKE_REQD 119_PKG_VARS.cmake+= CMAKE_REQD
121_PKG_VARS.cmake+= CMAKE_CONFIGURE_ARGS CONFIGURE_DIR 120_PKG_VARS.cmake+= CMAKE_CONFIGURE_ARGS CONFIGURE_DIR
122_PKG_VARS.cmake+= CMAKE_BUILD_ARGS BUILD_DIRS BUILD_TARGET 121_PKG_VARS.cmake+= CMAKE_BUILD_ARGS BUILD_DIRS BUILD_TARGET
123_PKG_VARS.cmake+= TEST_DIRS TEST_TARGET 122_PKG_VARS.cmake+= TEST_DIRS TEST_TARGET
124_PKG_VARS.cmake+= CMAKE_INSTALL_ARGS INSTALL_DIRS INSTALL_TARGET 123_PKG_VARS.cmake+= CMAKE_INSTALL_ARGS INSTALL_DIRS INSTALL_TARGET
125_SYS_VARS.cmake+= CMAKE_BUILD_DIR 124_SYS_VARS.cmake+= CMAKE_BUILD_DIR