Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22090

How to configure CMakeLists to use Windows command line compiler instead of Visual Studio

$
0
0

I would like to convert my project from a visual studio solution to build with cmake and compile with makefile

This is a 2-part question

  1. 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 CMakeLists to generate a makefile?

  1. 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://docs.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=vs-2019Do I need to target the cl.exe compiler? Would this work with Cmake and Makefiles?Im 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"

Viewing all articles
Browse latest Browse all 22090

Trending Articles