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

How to change makefile generator for CMake?

$
0
0

Asked this question:
CMake cannot indentify path to compiler mentioned by set(CMAKE_C_COMPILER "path") rule
received an incorrect rules order response(it was obviously correct).
Aplied changes and tried again:
cmake .
output:

-- The C compiler identification is GNU 9.2.0-- The CXX compiler identification is GNU 9.2.0-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exeCMake Error: Generator: execution of make failed. Make command was: nmake /nologo cmTC_fc6d3\fast &&-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - broken

But I need not nmake but mingw make file ,found this topic:
CMake Error : execution of make failed on Windows

The 100% same problem I have .Tried provided solution:

You need to specify a generator in CMake command line like -G "MinGW Makefiles" and - depending on how many compilers you have installed - also the full paths to the compilers.

cmake -G "MinGW Makefiles"

output:

CMake Warning:  No source or binary directory provided.  Both will be assumed to be the  same as the current working directory, but note that this warning will  become a fatal error in future CMake releases.CMake Error: Error: generator : MinGW MakefilesDoes not match the generator used previously: NMake MakefilesEither remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

and next cmake . output gives (after deleting CMakeCache.txt file and CMakeFiles directory as mentioned above):

-- The C compiler identification is GNU 9.2.0-- The CXX compiler identification is GNU 9.2.0-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exeCMake Error: CMake was unable to find a build program corresponding to "NMake Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.CMake Error: CMAKE_C_COMPILER not set, after EnableLanguageCMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:44 (try_compile):  Failed to configure test project build system.Call Stack (most recent call first):  CMakeLists.txt:9 (project)-- Configuring incomplete, errors occurred!See also "CMakeFiles/CMakeOutput.log".CMake Error: Generator: execution of make failed. Make command was:  cmTC_4b6e5/fast &&-- Check for working C compiler: C:/Strawberry/c/bin/gcc.exe - broken

The 3 things i cannot understand:

  1. How to ... specify ... the full paths to the compilers or needed source or binary directory.
  2. Why compilers are connected to make.exe in any way.
  3. Why CMAKE_MAKE_PROGRAM is not set if there is proper rule.

Changing rules order :

set( CMAKE_MAKE_PROGRAM FORCE ) set(CMAKE_C_COMPILER ) set(CMAKE_CXX_COMPILER ) and
set(CMAKE_C_COMPILER ) set(CMAKE_CXX_COMPILER ) set( CMAKE_MAKE_PROGRAM FORCE ) has the same result after call.

If I remove set( CMAKE_MAKE_PROGRAM ) rule configuring with CMake GUI is possible but with cmd manual cmake . call is not .Same output as provided above.

Inside CMakeCache.txt generated by CMake GUI call's are lines :

//Path to a program.CMAKE_MAKE_PROGRAM:FILEPATH=C:/Strawberry/c/bin/mingw32-make.exe

so for it was possible to find mingw32-make.exe and path provided for manual call is also right.

My CMakeLists.txt:

cmake_minimum_required(VERSION 3.17.1)#set(CMAKE_MAKE_PROGRAM C:/Strawberry/c/bin/make.exe FORCE )set( CMAKE_MAKE_PROGRAM C:/Strawberry/c/bin/mingw32-make.exe FORCE )set(CMAKE_C_COMPILER "C:/Strawberry/c/bin/gcc.exe")set(CMAKE_CXX_COMPILER "C:/Strawberry/c/bin/g++.exe")project("Client")enable_testing()set(CMAKE_CXX_FLAGS "-std=c++17 " )add_executable(Client  main.cpp  client.cpp  client.h  logmsg.cpp  includes.h)target_link_libraries(Client wsock32 ws2_32)add_test(NAME test COMMAND Client )

Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>