[CMake] Supplying different debug flags during compile and link stages for libraries and executables

Petr Kmoch petr.kmoch at gmail.com
Thu Jun 28 03:06:42 EDT 2012


Hi Brett,

as far as I know, compilation flags come from
CMAKE_<lang>_FLAGS_<config>, while linker flags come from
CMAKE_{SHARED|EXE}_LINKER_FLAGS[_<config>]. So you should be able to
override CMAKE_SHARED_LINKER_FLAGS_Debug (not sure with correct case
for configuration name) and remove -g from there.

Petr

On Wed, Jun 27, 2012 at 10:36 PM, Brett Delle Grazie
<brett.dellegrazie at gmail.com> wrote:
> Hi,
>
> On AIX using the XLC compiler I've determined the debug flag (-g)
> should be used for all compile stages but should only be supplied to
> the final
> link stage of an executable (not a library target), otherwise
> duplicate symbol errors result.
> For reference see:
> http://www.ibm.com/developerworks/forums/thread.jspa?threadID=438591&tstart=0
>
> Is there an easy way of supplying a different set of debug flags for
> the compile stage as opposed to the link stage?
>
> I could potentially override:
> CMAKE_C_FLAGS_DEBUG_INIT
> CMAKE_CXX_FLAGS_DEBUG_INIT
>
> but I can't really see where these are combined into the compile / link rules.
>
> Does anyone have any suggestions? Any guidance / help is appreciated.
>
> Thanks,
>
> --
> Best Regards,
>
> Brett Delle Grazie
> --
>
> 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


More information about the CMake mailing list