Distributing program with OpenMP

I'd like to distribute my program that uses OpenMP built with CLang
5.0. I use CLang/LLVM as provided by MacPorts.

I need to distribute my program to users who won't have MacPorts or a
compiler installed.

Unsurprisingly, output of otool shows that my program needs libomp.dylib:

otool -L myprogram
myprogram:
/opt/local/lib/libomp/libomp.dylib (compatibility version 5.0.0,
current version 5.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1226.10.1)

Previously, I had compiled my program using gcc and was able to link
OpenMP statically

otool -L myprogram
myprogram:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 159.1.0)

By doing something like this:

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
endif()

Is there a way to do this with CLang?

If not, what is the preferred way to bundle the required OpenMP library?

I build from a CMake environment, so on Windows, I already do this:
INCLUDE( InstallRequiredSystemLibraries )
to grab all the required OpenMP libraries and whatnot.

My program is distributed as a dumb *.zip file -- nothing that gets
installed to the system. Will this still work in this paradigm, or
will I need to get permission and install this library?

Rob

Hi Bob,

static linking of the OpenMP runtime is in general discouraged because it produces all sort of nasty problems if there is still any shared library that also uses OpenMP. I think this is also why no static library is built by default but you can build only the OpenMP runtime yourself and enable an option for that (-DLIBOMP_ENABLE_SHARED=OFF). Then you might try passing -static to clang or some similar options.
Another possibility would be to bundle the shared library and set an rpath for the current (relative) directory. I think this might be possible but I can't verify at the moment.

Let us know if any of this worked,
Jonas