CMAKE changing Visual Studio Settings - visual-studio-2012

I've been using CMAKE recently on Linux and Windows and I really like it. Its a great way of spinning up a project and organizing your builds. There are just a few things that are bugging me and I'm hoping to get help here.
Visual Studio Settings
Everytime CMAKE generates a project it will be a fresh solution and will not maintain any of the settings you applied to the Visual Studio project. I know that many things such as CMAKE_CXX_FLAGS, etc can change the properties. But what if I want to change settings such as "Suppress Startup Banner", "Environment", Enabling Microsoft Symbol Server, Enabling Native Code Debugging. How do I force CMAKE to set the options I want for fields like these?
Combining Debug/Release/Etc into one solution
It seems that with CMAKE you have to do separate generations for Debug/Release/etc. But in typical manually created Visual Studio projects you can combine the profiles and just change a project setting to get your new settings. Is it possible to generate a single solution file from CMAKE?

Okay so I scoured the CMAKE boards as well. Here are the answers I found.
Visual Studio Settings
For this one CMAKE can't modify the *.user files at all. However what was proposed was to make a user file template and then use CMAKE to supply all the paths and such that you are concerned with. This worked very well for me.
Combining Debug/Release/Etc into one solution
To change various settings on a per configuration basis. It seems like it is best to use fields like CMAKE_CXX_FLAGS_ and most importantly generator expressions. Generator expressions allow you to test for the build type and then generate whatever include, libraries, etc that you need.
Take a look at "Generator Expressions" here

Related

Visual Studio 2015 code map external dependencies

I have a native Win32 project written in C and wanted to visualize my project's dependencies from external DLLs. Visual Studio 2012 and 2013 let me generate a code map which would not only show all my functions and their dependencies from each other using arrows, but also all external libraries I used, which functions I used from those and which of my functions called which external functions etc..
Now, in Visual Studio 2015, this latter part seems to be missing. I can not get Visual Studio to show my project's external dependencies. I only see the internal ones. So here's my questions: Am I missing something? Do I have to activate a specific option in my project settings? Or are those external dependencies just not working in Visual Studio 2015 right now?
Steps to reproduce: Create a new non-empty Win32-project. In the Architecture menu, select Generate code map for solution. You will only see Win32Project1.exe in the middle of the screen. Meanwhile, Visual C# seems to be fine, showing the external dependencies. Create any C#-project for comparison.
Thank you for taking the time to post this! This looks like a regression, as in Visual Studio 2013 an Externals group with external dependencies is shown for C++.
I've logged a bug on Microsoft Connect so that you're able to track this externally:
https://connect.microsoft.com/VisualStudio/feedback/details/1694695
I have posted this workaround on the link that Bogdan Gavril listed and hope it helps someone. Unfortunately, it requires that you enable "CLR" support for your project. Basically, it appears that the VC++ linker and librarian is looking for a flag that indicates some type of managed code. At the very least, the code map is dependent on the mscorlib.dll reference injection. To make the CLR issue (which adds a lot of unnecessary bulk for native code) less a problem, simply create a new build configuration for use only when you need code maps with external dependencies. Make sure you've selected "CLR Support" on the general options of the project properties configuration page. Then, clean (probably not necessary) your solution and generate a code map. You will find the external dependencies as expected!
Zac

Better LESS compiler options for Visual Studio?

I'm new to VS, coming from the Mac where I used the excellent CodeKit for LESS compiling. I've installed the Web Essentials add-on, so I have basic LESS support and compiling.
The major shortcoming with this plugin is when saving files that are imported into a main.less file, the main.less file does not compile unless I open it specifically and save it.
I'd prefer a solution like CodeKit, which would compile the parent file if any of the children are modified. Are there any other plugins, even commercial ones, which do this?
There's an option in Web Essentials to "compile all LESS files", which would almost do what I want, but it throws an error:
In WebEssentials there is an option (tools>Options>WebEssentials>Less) to Compile all files on Build, which you'll probably do before publishing anyway. You might want to add your votes to the UserVoice ticket for this issue.
BundleTransformer allows you to have ASP.NET do the transformations on the fly (at runtime), having it compile, minify and compress all in one go. You won't have to recompile your files inside Visual Studio itself. You can keep using WebEssentials for intellisense.
And then there is the Mindscape Web Workbench which provides similar functionality as Webessentials. Their Pro edition ($) can also compile files on save & build.
I personally prefer http://wearekiss.com/simpless You can use it even in Express edition since it's not integrated inside VS.
Just open the Simpless drag and drop the file and it will compile your file automatically when they has been modified from your VS (or any of editor).
Web Essential is also have suggest in someone answer.

Visual Studio 2012 speed big solution

Can you please advice how I can speed up a compiling, loading big solution (~50 projects).
I mean only VS 2012 studio or Windows settings, not hardware changes.
Thanks
Consider your need for 50 projects in one solution - having many projects that are referenced by each other is one of the main reasons for slowdowns.
One of the few valid reasons to have separate projects is because you need to deploy the generated assemblies separately. If this is not the case, consider combining projects - use folders for the logical separation.
The lower the number of projects, the faster your build will become.
In addition, if you change the builds to output to a specific shared directory and reference the DLLs instead of the projects, the number of unneeded re-compilations should go down drastically, though you will have to manage the build order yourself.
I use 100+ projects in a solution with Visual Studio 2012 Update 3, and it builds fast.
I agree with shared output directory comment by Oded, but I'd like to mention that project references work OK too.
Make sure that your \Users\\AppData\Local\Microsoft\WebsiteCache folder is empty. Somehow, this is a problem even with desktop-only solutions.
I have disabled Productivity Power Tools 2012, since they compile code in the background, a bit too much for my liking. Disable all plug-ins and extensions and see if it makes any difference.
Suppress excessive output messages to disk and to screen by reducing output verbosity
Use multicore with MSBuild.
As you code, try to limit dependencies between projects by using interfaces and abstract classes (C#).
Try fresh *.suo and fresh *.sdf files. (Make a backup of the user settings and DB, then remove them and try building again)
When all else fails, use ProcessMonitor or attach with another instance of Visual Studio to profile your Visual Studio while it's building.
Try excluding file system filters, such as antivirus, from your build. For example, some antiviruses have a way of skipping scanning in certain directories or by file names.

Getting others to use my apps with Visual C++

I am learning how to build games in Visual C++ and when I upload them so friends can check them out, they all end up with messages saying it can not run. I did some research and found that it is because I am compiling against a Dynamic library instead of a static library. Correct me if I am wrong anywhere please. Upon further research, I found that a lot of people do not advise going this direction but instead include the files needed by my game.
How would I go about distributing my games to friends and make it real easy for them to just open up my .exe and play the game?
If you link to any DLLs, you also need to ship those along. If you produce a single .exe in your output, you probably need your friends to install the MS Visual Studio redistributable package for your version of visual studio. This is an example link for the VS 2010 one, but the one you give your friends should match your version.
There are essentially two options: Keep everything as-is and provide them with the runtime files (also named Microsoft Visual C++ * Redistributable Package or similar; the * has to be replaced with your version, e.g. 2005, 2008 or 2010). Downloads can be found on Microsoft's download site as well as in your Visual Studio installation folder (look for a folder called "Redist").
Alternative solution: In your project settings you're able to select the runtime environment (under linker options). Change your release build to use "Multithreaded" instead of "Multithreaded-DLL".

Get intellisense data for uncompiled projects

I inherited a project setup from a previous programmer. He used to develop for linux, but instead of coding directly in ubuntu, he shared the drives with samba and used Visual Studio to edit the files.
Now I can't compile this project in Visual Studio directly obviously, so I can't get data for intellisense and such. Would it be possible to associate symbols without compiling?
I know that what I ask seems counter intuitive, but Vim plugin OmniCPP does not come with a compiler and yet, is able to provide code completition up to a certain degree.
The commercial addin Visual Assist X can help. How well it helps is dependent upon how much information it can get from the project (if one exists): things like source files, header files and include directories. If no project is being used, you can create a dummy project just as a container to associate source and header files (not for compiling).

Resources