git: b40aa9707101 - main - Mk/Features: WITH_PIE - add cmake support

From: Alexander Leidinger <netchild_at_FreeBSD.org>
Date: Tue, 14 May 2024 08:39:27 UTC
The branch main has been updated by netchild:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b40aa97071012f71a9c8937ef41d3153f070243f

commit b40aa97071012f71a9c8937ef41d3153f070243f
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-05-14 08:35:00 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2024-05-14 08:39:24 +0000

    Mk/Features: WITH_PIE - add cmake support
    
    Use cmake specific options to enable position independent code generation.
    
    This fixes several ports (at least multimedia/cmrtlib, math/blas and
    math/lapack) which are build with cmake when WITH_PIE is enabled.
    
    PR:             268981
    Approved by:    portmgr
---
 Mk/Features/pie.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Mk/Features/pie.mk b/Mk/Features/pie.mk
index 2f7b902f2660..06174b403c31 100644
--- a/Mk/Features/pie.mk
+++ b/Mk/Features/pie.mk
@@ -5,11 +5,15 @@ _PIE_MK_INCLUDED=	yes
 PIE_Include_MAINTAINER=	portmgr@FreeBSD.org
 
 .  if !defined(PIE_UNSAFE)
+.    if defined(_INCLUDE_USES_CMAKE_MK)
+CMAKE_ARGS+=	-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true
+.    else
 PIE_CFLAGS?=	-fPIE -fPIC
 CFLAGS+=	${PIE_CFLAGS}
 CXXFLAGS+=	${PIE_CFLAGS}
 LDFLAGS+=	-pie
 STATIC_PIE_ARGS+=	-static-pie
+.    endif
 .  endif
 .endif