On a Mac, using GCC's global -static is bad, so that doesn't work out.

However, as it turns out, -static-libgcc implies all parts of libgcc,
including libgomp.  So, building with -static-libgcc -static-libstdc++
looks like the best solution.

Rob


On Thu, Apr 30, 2015 at 2:19 PM, Rob McDonald <[email protected]> wrote:
> I'm using MacPorts GCC 4.8 and CMake 3.2.
>
> I use 'FIND_PACKAGE( OpenMP )', and then use OpenMP_C_FLAGS and
> OpenMP_CXX_FLAGS appropriately.
>
> My application works on the machine that I build on.  However, users
> without MacPorts GCC installed can't find libgomp.1.dylib on their
> machine.
>
> I'd like to tell GCC to statically link libgomp.  I think the global
> -static flag may do this, but it seems like a fairly brutish way of
> getting the job done.
>
> Is there a way to get CMake to tell GCC to statically link libgomp?
> Or to have more fine grained control over which libraries are static
> vs. dynamic?
>
> Is there any reason to not want to use the global -static?
>
> FindOpenMP.cmake isn't like most other Find*.cmake scripts -- instead
> of searching for a *.h, *.a, *.so, or *.dylib file, it checks various
> flags to the compiler -fopenmp, /openmp, etc.  From that, it
> determines the appropriate flags, but there isn't any
> ${OPENMP_LIBRARIES} to use in a later TARGET_LINK_LIBRARIES later on.
>
> Thanks,
>
> Rob
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to