Hi,

if I set compiler flags using CMAKE_C_FLAGS these flags are also added
to the linker flags for C executables and libraries. How can I set
compiler flags without those same flags also appended to the linker
flags?

In this specific case I would like to add "-fopenmp" to the compiler
but do not want this flag to be added to the linker because I want the
openmp library to be linked statically.  For GCC this can be done with
"-Wl,-static -lgomp -lrt -Wl,-Bdynamic -lpthread" but only works if
"-fopenmp" is not also given as a linker flag. Thus it is important
that "-fopenmp" which is needed as compile time option is not appended
to the linker flags.

This is with GCC on Linux with "Unix Makesfiles" and cmake 2.8.8.

Roland
-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to