I\'m currently porting a gcc project to Visual C++. It\'s defined in a CMake file, and I have created a Visual C++ property sheet to aid in compatibility (GccCompat.props). Ever
This question is a little bit old but I have recently stumbled upon the same problem while integrating GStreamer into my project. GStreamer comes with a set of extremely well prepared and high quality Property Sheets and I wanted to use them instead of hacking things around in CMake.
Fortunately, this issue is only limited to Windows and Visual Studio. So here's my solution:
The idea is to use Visual Studio's .user file feature. CMake does not generate this file so it's pretty safe to generate it at configure-time. At configure time you may generate a file that has the EXACT name as your project file but ends with a .user extension.
If your project file is named my_project.vcxproj
, you need to create another file next to it called my_project.vcxproj.user
. According to MSDN:
A user file (.vcxproj.user) stores user-specific properties, for example, debugging and deployment settings. The vcxproj.user file applies to all projects for a particular user.
The contents of this file for importing property sheets is something like this:
Not flawless, but works until CMake starts supporting property sheets. The file can be created by using CMake's file command at configure-time.
I have noticed when I add property sheets this way, sometimes they do not show in the Property Manager window (might be a bug in Visual Studio Community 2013) but they always are imported properly and dependencies are resolved correctly.