How can I get the "Visual Studio 2012" cmake generator on mac? - c++

For a CS class I'm taking, the C++ assignments need to be submitted as Visual Studio 2012 projects. I'd really rather not use Visual Studio, so I'm thinking about creating cmake projects instead, then generating Visual Studio project files using cmake. I know this is possible using cmake -G "Visual Studio 11", but this only seems to work on Windows. When I run cmake on my computer, I get a list of generators, and the Visual Studio generators aren't listed. I know that the cmake website says that generators are platform specific, but is there some way to get these generators working on OS X?
Edit: For anyone coming across this question later, you should look into premake instead of messing with cmake. If you get premake 5, which is currently the development version, you can use it to generate Visual Studio 2012 files from Mac or Linux without needing to use Windows at all (on Windows you can generate Xcode projects without having to use OS X as well).

CMake needs to call Visual Studio compiler to check compiler version, so I doub't it could find it on OS X, that why it's platform specific.

Related

Error: No CMAKE_Fortran_COMPILER could be found for Visual Studio 2019 Fortran support

I am using CMAKE to build Open Source Projects (like those are available at GitHub etc.) and I also have installed Visual Studio 2019. There is a problem that CMAKE can not find Fortran compiler in my system whereas I've installed MinGW with Fortran compiler. The error is:
**The Fortran compiler identification is unknown**
**No CMAKE_Fortran_COMPILER could be found.**
How can I solve this problem and make CMAKE be aware of Fortran compiler?
Note: I tried other projects that does not require Fortran compiler and those are built successfully.
Installed software:
CMAKE 3.18.5,
Visual Studio 2019,
MinGW
You need to show where your fortran executable file to CMakeList.txt like
set(CMAKE_Fortran_COMPILER "C:/MinGW/bin/gfortran.exe")
EDIT 2 for Visual studio 2019:
If you want to produce Visual Studio 2019 solution
Download IntelĀ® oneAPI HPC Toolkit here.
If cmake cannot find Fortran compiler add a cmake flag CMAKE_Fortran_COMPILER with the value of ifort.exe path that u installed above. Like %install_path%/Intel/oneAPI/compiler/2021.1.1/windows/bin/intel64/ifort.exe
Configure and generate solution.
EDIT:
Alright, now I understand why you get this error. The Visual Studio generator does not support MinGW gfortran. They are totally separate ecosystems.
Remove your build directory and create a fresh one. Then use cmake .. -G "MinGW Makefiles" instead. I tried from CLI prompt of msys and successfully obtained the libraries from Windows machine.
If you are using Intel processors, you should first set-up Fortran environment for Visual Studio 2019
Better to check compilation guide and some troubleshooting Fortran Integration Issues with visual studio

how/where to grab compiler of msvs 2008 (32bit) compiler toolchain without installing msvs2008 [duplicate]

This question already has answers here:
download and install visual studio 2008 [closed]
(6 answers)
Closed 5 years ago.
I'm relatively new-comer to developing in windows ("7") and the environment that has been set up for me is using as IDE MS Visual Studio 2015. For a new project I'll be involved in I will work with a team who have been developing in Visual Studio 2008 a 32bit application.
As I try to create the development environment using cmake and selecting as target compiler "Visual Studio 9 2008" , cmake whines that
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_CXX_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (project):
No CMAKE_C_COMPILER could be found.
So I would need to obtain the respective toolchain. I have no idea how to do that in windows though and google (at least with the search terms I have used) has not been very helpful.
Note: The IDE of the team is indeed old but it is not an option to ask all of them to migrate now to a newer version.
Note2: As I understand, I cannot obtain a license for "Visual Studio 2008" anymore, but even if this is not the case, I would prefer to continue using visual studio 2015 even while developing this project. Is it possible to just obtain the compiler toolchain of 2008 and integrate it somehow so that
1) cmake can find it
2) visual studio 2015 can use it
Easiest way to go would be to install Visual studio 2008 Express if you can find the installer. It is free, and you can use its compiler without using the IDE.
In cmake you can separately select target IDE version (generator) and target compilers (toolchain).
AFAIK there was no separate download just for the compilers but there were some bundles which include it and you can try your luck with them if you can't/don't want to install full VS2008 installation (cmake might have some difficulties finding this versions though).
"Microsoft Visual C++ Compiler for Python 2.7" package should contain just the compiler/libraries part of the VS 2008
"Windows SDK 6.1" and "Windows SDK 7.0" (but not "Windows SDK 7.1") include a version of the compiler which should be compatible with VS2008

Force Cmake & Emscripten to use VS 2010 for compiling

How can I force Cmake to use Visual Studio 2010 for compiling my emscripten projects, and now VS 2015?
I keep running into an issue where cmake says it cannot find the build tools for MSBuild v140. I know it exists though, as the file path is
C:\Program Files (x86)\MSBuild\14.0\Bin
I've even tried setting the path in the Emscripten Command Prompt with
set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
but the issue still occurs.
If I open this solution in VS 2015, I can see that the configuration is set to Msbuild v 1.40, so I can't wrap my head around why Emscripten says it can't locate it.
The closest thing I could find is in this GitHub bug report on Emscripten.
Any suggestions?
Emscripten in Visual Studio is only supported for VS2010 AFAIK. Personally, I suggest you work with makefiles when generating from CMake. It is much more stable from my experience. The Visual Studio support for Emscripten is not working well, at least for me.
But if you still want to use VS2010, then you have to set the CMake generator to "Visual Studio 10 2010", and then specify the Emscripten toolchain file. You might have to set the CMake platform name to Emscripten, using the -A argument.
cmake.exe -G "Visual Studio 10 2010" -A Emscripten -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%\cmake\Modules\Platform\Emscripten.cmake
I tried doing this, but each time I did, Emscripten would return a different path to Emscripten.cmake, and say it couldn't find it. Not sure where it was getting this new path from.
Long story short, I realized I installed the web installer for Emscripten installed. So I uninstalled that and instead went with the Full installer, and it all worked well.

Any problems with having Code::Blocks and MS Visual Studio on same machine

I have installed Code::Blocks on my (Windows) machine. It is working fine.
However there are some open source libraries that i would like to use. For this i will have to build the library on my machine. However the source code is available in the form of a MS Visual Studio solution file.
I've tried to use the 'Import Project' feature of Code::Blocks but got errors with that. I am now thinking of installing MS Visual Studio express edition to see if can build the library using it. I do want to keep my install of Code::Blocks.
I wanted to ask if there are any problems having these two IDEs (Code::Blocks & MS Visual Studio Express Edition) on the same machine? I know they use different default compilers.

Compile Visual Studio projects without having Visual Studio installed?

Is there a way to compile a Visual Studio 2012 project without having the VS installed? I need to compile C++ stuff for windows quite rarely and buying the product is not justified as there's no profit (community projects). In most of the cases the project and solution files will be available. If there's a way to compile the code with SDK, could you please share an example?
Thanks!
You can download visual studio express for free. Whenever you build a solution, the bin folder in your project folder will contain the compiled code.
http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
EDITED: (per MS website)
Visual Studio Express 2013 for Windows Desktop enables the creation of desktop apps in C#, Visual Basic, and C++, and supports Windows Presentation Foundation (WPF), Windows Forms, and Win32.
Sign in to Visual Studio within 30 days with your Microsoft account to synchronize your settings across multiple machines and register your product.
Your best bet is likely going to be using msbuild which will allow you to build a solution or project without having Visual Studio installed.
If you have the free version VC++ Express installed (and thus the compiler toolchain), you might find it more interesting to use Eclipse CDT as IDE on top. At least the newer versions (I think since Helios) support using the native MS toolchain. You can import from native
VS projects also.
Eclipse is the more powerful IDE IMHO, and will additionally support other toolchains (either cross compiling, or Windows alternatives as MinGw GCC).