FindOpenMP: Incorrect OpenMP::OpenMP_Fortran target properties for NAG Fortran compiler
The FindOpenMP module sets up the OpenMP::OpenMP_Fortran
target incorrectly, when the NAG Fortran-compiler is used. As a result, linking a binary fails with following error message:
[100%] Linking Fortran executable test
NAG Fortran Compiler Release 7.0(Yurakucho) Build 7020
/opt/nag/7.0.20/lib/NAG_Fortran/safefit.o: In function `__NAGf90_pAlloc':
newfit.c:(.text+0xeda0): multiple definition of `__NAGf90_pAlloc'
/opt/nag/7.0.20/lib/NAG_Fortran/quickfit.o:newfit.c:(.text+0xbfb0): first define
d here
/opt/nag/7.0.20/lib/NAG_Fortran/safefit.o: In function `__NAGf90_lpAlloc':
newfit.c:(.text+0xede0): multiple definition of `__NAGf90_lpAlloc'
/opt/nag/7.0.20/lib/NAG_Fortran/quickfit.o:newfit.c:(.text+0xbfe0): first define
d here
...
The error can be reproduced with the attached self-contained minimal example, using Release 7.0 (Buid 7020) of the NAG Fortran compiler and CMake 3.18.2.
As indicated in the attached CMakeLists.txt file, a workaround can be achieved by overwriting the appropriate target properties:
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY
INTERFACE_LINK_LIBRARIES "")
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_OPTIONS "-openmp")
But this is propably not the correct way to solve the issue. Any hints are welcome.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information