On 11/5/19 7:30 AM, Alexander wrote:
> string(APPEND CMAKE_SHARED_LINKER_FLAGS " -DEF:\"foo_1.def\" 
> -DEF111:\"foo_1.def\"")

This was the first you've mentioned using more than one copy of the flag.

I tested with this:

```
string(APPEND CMAKE_SHARED_LINKER_FLAGS " 
-DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/foo.def\"")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " 
-DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/bar.def\"")
```

With the command-line generators like Ninja or NMake Makefiles, both flags
appear.  With the Visual Studio generators, only the latter flag appears.

The reason is that CMake maps the `-DEF:` linker flag to the `.vcxproj`
file element `ModuleDefinitionFile` but only puts one value in it.  The
MSBuild documentation for that field is here:

  https://docs.microsoft.com/en-us/visualstudio/msbuild/link-task?view=vs-2019

and says "Specifies the name of a module definition file."  AFAIK it only
supports one value.  This is a limitation of MSBuild.

-Brad
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers

Reply via email to