CMAKE for /DEF and /NODEFAULTLIB

etwas77 picture etwas77 · Sep 13, 2013 · Viewed 11k times · Source

How do I add linker-flags "DEF" and "NODEFAULTLIB" to vs2012 project via CMAKE?

Answer

Fraser picture Fraser · Sep 13, 2013

You can append them to CMAKE_EXE_LINKER_FLAGS:

if(MSVC)
  set(CMAKE_EXE_LINKER_FLAGS
      "${CMAKE_EXE_LINKER_FLAGS} /DEF:my_defs.def /NODEFAULTLIB")
endif()