Skip to content

OpenMP is not correctly included in the CMake file and causes compile errors #41

@schulz0r

Description

@schulz0r

Dear developer team,
I am using Apple Clang to compile ColPack. The compiler throws errors because of missing omp headers. This is because the CMakeLists.txt does not include OpenMP in a correct way. Here is an instruction manual on how to include OpenMP to your projects:

target_link_libraries(ColPack_static PUBLIC OpenMP::OpenMP_CXX)
...
target_link_libraries(ColPack_shared PUBLIC OpenMP::OpenMP_CXX)

It is not enough to add a compiler flag indicating that OMP is being used. It consists of headers, binaries etc., so you have to link ColPack against the whole target OpenMP::OpenMP_CXX. CMake does the rest for you, including adding the needed compiler flags. I think you can savely delete the lines where you set with the set_target_properties() call.

Regards
Schulz0r

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions