Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,235
    • Issues 3,235
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 14
    • Merge Requests 14
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21280

Closed
Open
Opened Oct 07, 2020 by Bálint Aradi@baradi09

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.

CMakeLists.txt test.f90

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.

Edited Oct 07, 2020 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#21280