Index: configure/cmake.mk =================================================================== RCS file: /cvsroot/pkgsrc/mk/configure/cmake.mk,v retrieving revision 1.14 diff -u -r1.14 cmake.mk --- configure/cmake.mk 21 Oct 2016 11:13:35 -0000 1.14 +++ configure/cmake.mk 28 Jul 2017 06:19:15 -0000 @@ -30,11 +30,17 @@ # CMAKE_INSTALL_PREFIX # Destination directory to install software. The default is ${PREFIX}. # +# CMAKE_OUTSOURCE_BUILD +# If set to yes, build out-of-source in ${WRKDIR}/.cmake_build +# directory. The default is no. +# _CMAKE_DIR= ${BUILDLINK_DIR}/cmake-Modules CMAKE_USE_GNU_INSTALL_DIRS?= yes +CMAKE_OUTSOURCE_BUILD?= no + CMAKE_INSTALL_PREFIX?= ${PREFIX} CMAKE_ARGS+= -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} Index: configure/configure.mk =================================================================== RCS file: /cvsroot/pkgsrc/mk/configure/configure.mk,v retrieving revision 1.25 diff -u -r1.25 configure.mk --- configure/configure.mk 1 Jun 2012 12:52:37 -0000 1.25 +++ configure/configure.mk 28 Jul 2017 06:19:15 -0000 @@ -236,9 +236,18 @@ _CONFIGURE_CMAKE_ENV+= BUILDLINK_DIR=${BUILDLINK_DIR} _CONFIGURE_CMAKE_ENV+= ${CONFIGURE_ENV} +.if defined(CMAKE_OUTSOURCE_BUILD) && !empty(CMAKE_OUTSOURCE_BUILD:M[Yy][Ee][Ss]) +_DO_CONFIGURE_CMAKE_TARGET= do-configure-cmake-outsource +BUILD_DIRS= # flush +.else +_DO_CONFIGURE_CMAKE_TARGET= do-configure-cmake-insource +.endif .PHONY: do-configure-cmake -do-configure-cmake: +do-configure-cmake: ${_DO_CONFIGURE_CMAKE_TARGET} + +.PHONY: do-configure-cmake-insource +do-configure-cmake-insource: .for _dir_ in ${CONFIGURE_DIRS} ${RUN}${_ULIMIT_CMD} \ cd ${WRKSRC} && cd ${_dir_} && \ @@ -246,6 +255,30 @@ cmake ${CMAKE_ARGS} ${CMAKE_ARG_PATH} .endfor +.if defined(CMAKE_OUTSOURCE_BUILD) && !empty(CMAKE_OUTSOURCE_BUILD:M[Yy][Ee][Ss]) +. for _src_ in ${CONFIGURE_DIRS} +. if ${_src_} == ${WRKSRC} +_suff=_build +. elif ${_src_:S,^${WRKSRC},,} != ${_src_} +_suff=_build_${_src_:S,^${WRKSRC},,:S,^/,,:S,/,_,g} +. else +_suff=_build_${_src_:S,/,_,g} +. endif +_bin_=${WRKDIR}/.cmake${_suff} +_CMAKE_SRCBIN_DIRS+=${_src_} ${_bin_} +BUILD_DIRS+=${_bin_} +. endfor +.endif + +.PHONY: do-configure-cmake-outsource +do-configure-cmake-outsource: +.for _src_ _bin_ in ${_CMAKE_SRCBIN_DIRS} + ${RUN}${_ULIMIT_CMD} \ + ${MKDIR} ${_bin_} && cd ${_bin_} && \ + ${PKGSRC_SETENV} ${_CONFIGURE_CMAKE_ENV} \ + cmake ${CMAKE_ARGS} ${CMAKE_ARG_PATH} ${_src_} +.endfor + ###################################################################### ### pre-configure, do-configure, post-configure (PUBLIC, override) ######################################################################