Patch to cmake detect OpenMP
Matthieu Volat
mazhe at alkumuna.eu
Tue Sep 20 07:04:18 UTC 2016
On Tue, 20 Sep 2016 00:55:44 -0300
Otacílio <otacilio.neto at bsd.com.br> wrote:
> I'm trying to port flann (http://www.cs.ubc.ca/research/flann/) to
> FreeBSD, but I need that cmake detects OpenMP. Unhappy, cmake do not
> detects OpenMP even when devel/openmp is installed, so I did this patch
> to cmake port. What you guys think about? Can I open a bug report with
> patch?
>
> []'s
>
Hi, are you planning to submit this patch for cmake in ports or the upstream project?
This is not a really good idea to hardcode /usr/local like that, for there can be may more providers for libomp (lang/clangXY ports, if you need a specific to workaround bugs for example... or even maybe base in the future?). Also, it would break cmake with GCC.
Without changing any upstream code in either cmake or flann, for FreeBSD 11+, you can just set :
USES+= compiler:openmp
CFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib -lomp -lm
I did not test how this behave on older release yet... And if you need to build cmake-based projects outside ports, here's the flags I use:
-DCMAKE_REQUIRED_INCLUDES="/usr/local/include" \
-DCMAKE_REQUIRED_LIBRARIES="-L/usr/local/lib -lomp -lm" \
-DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -lomp -lm" \
-DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/lib -lomp -lm" \
-DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/lib -lomp -lm"
-- Matthieu Volat <mazhe at alkumuna.eu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20160920/d579fc29/attachment.sig>
More information about the freebsd-ports
mailing list