I would like to convert my project from a Visual Studio solution to build with CMake and compile it with Makefiles.
This is a 2-part question.
Right now the CMakeLists.txt is:
cmake_minimum_required(VERSION 3.13.0) project(Project2015 CXX) add_executable(Project Source/main.cpp)
When I run cmake ..
out of the build directory, it generates *.vcxproj and *.sln files, but there is no Makefile. How can I change the CMakeLists file to generate a Makefile?
What is the command line equivalent compiler to
gcc
for windows? And how do I set this compiler as the target for CMake and the generated Makefile? Reading about the build tools https://learn.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=vs-2019 Do I need to target thecl.exe
compiler? Would this work with CMake and Makefiles? I'm reading online that these command line flags will set the compiler, how can I add these to the CMakeLists.txt to be used automatically?DCMAKE_C_COMPILER=cl DCMAKE_C_COMPILER_FORCED=ON DCMAKE_CXX_COMPILER=cl DCMAKE_CXX_COMPILER_FORCED=ON DCMAKE_BUILD_TYPE=Debug DCMAKE_INSTALL_PREFIX=%CFITSIO_DIR% G"NMake Makefiles"