Search code examples
visual-studiocmakeprojectprojects-and-solutionsfunction

CMake: How to add .def file to Visual Studio project filters?


How to add .def file to Visual Studio project filters (*.filters file)? Visual Studio consumes .def file.

CMake code:

set(a_src a.cpp a.def)
add_library(a SHARED ${a_src})

In solution and then in project there is no a.def file in filters, only a.cpp. But CMake generates a rule for .def file (/DEF:a.def option to linker).

Is there any way to show .def files in the project filters (a.filters file near the project)?


Solution

  • This is a CMake bug. It is reported in their tracker at http://www.cmake.org/Bug/view.php?id=15313