How to set the LDFLAGS in CMakeLists.txt?

后端 未结 5 2278
小蘑菇
小蘑菇 2020-11-30 22:15

I set the CFLAGS in CMake by CMAKE_C_FLAGS. Is something like this to set LDFLAGS?

5条回答
  •  盖世英雄少女心
    2020-11-30 22:57

    For linking against libraries see Andre's answer.

    For linker flags - the following 4 CMake variables:

    CMAKE_EXE_LINKER_FLAGS
    CMAKE_MODULE_LINKER_FLAGS
    CMAKE_SHARED_LINKER_FLAGS
    CMAKE_STATIC_LINKER_FLAGS
    

    can be easily manipulated for different configs (debug, release...) with the ucm_add_linker_flags macro of ucm

提交回复
热议问题