<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>On the target_link_libraries() command documentation page, it is
      written that it is possible to pass flags to this function, if
      they start with a '-' character.<br>
      This functionnality seems to be broken with Visual Studio. Indeed
      flags in the Visual Studio linker are using slashes instead of
      dash.<br>
    </p>
    <p>For instance, trying to enable map file generation in the linkers
      is failing:</p>
    <p>target_link_libraries(${PROJECT_NAME} -MAP)</p>
    <p>Resulting output in the linker command line is "-MAP" (note the
      presence of quotes). It should be /MAP (without quotes) in order
      to be properly recognized by the linker command-line parser. After
      few researches, it seems that this issue is similar:<a
        href="http://public.kitware.com/pipermail/cmake/2015-June/060989.html">
        http://public.kitware.com/pipermail/cmake/2015-June/060989.html</a><br>
    </p>
    <p>Context:</p>
    <p>I have a library called lib_project. I have an executable
      my_project that links against lib_project. When linking the final
      binary, I need to enable UAC support in order to force execution
      of the binary as administrator (<a
href="http://stackoverflow.com/questions/1655089/cmake-requireadministrator">http://stackoverflow.com/questions/1655089/cmake-requireadministrator</a>).
      lib_project uses a Windows API that needs administrator level set
      in the final executable. So I would like to force my_project to
      set this specific flag, but I would like to see this set in the
      CmakeLists.txt of lib_project. Regarding the documentation, the
      following command should do the trick (but not working currently):</p>
    <p>target_link_libraries(lib_project PUBLIC
      -level='requireAdministrator' -uiAccess='false')</p>
    <p>Please not that the -level can bring bugs as it could be
      interpreted by Cmake as "link against 'evel' library".<br>
    </p>
    <p>Do I have pointed a new bug in the Visual Studio generator? Would
      a target_link_flags() command be a good idea to implement?<br>
    </p>
    <p>Best regards,<br>
    </p>
    L-P<br>
    <div class="moz-signature"><br>
    </div>
  </body>
</html>