question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use cmake generator "NMake Makefiles" with conan

See original GitHub issue

If I set environment variable CONAN_CMAKE_GENERATOR to"NMake Makefiles", conan correctly passes -G "NMake Makefiles" to cmake during configure but build fails with

NMAKE : fatal error U1065: invalid option 'j'                                                     
Stop.                                                                                             
ERROR: PROJECT: Error in build() method, line 30                                                  
        cmake.build()                                                                             
        ConanException: Error 2 while executing cmake --build C:\Work\conan-test\build -- -j4

the problem is here: https://github.com/conan-io/conan/blob/develop/conans/client/build/cmake.py

            if "Makefiles" in self.generator:
                if "--" not in args:
                    args.append("--")
                args.append("-j%i" % cpu_count())

You always add -j flag for Makefiles generators but NMake does not understand that.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:25 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
db4commented, Jan 29, 2018

Yes, it works for me. Thanks a lot!

1reaction
db4commented, Jan 29, 2018

@memsharded,

I am a bit surprised that CMake is not able to find VS cl.exe while using NMake Makefiles generator

That’s quite obvious. For Visual Studio generator cmake knows the target toolchain and architecture from its name (like Visual Studio 15 2017 Win64). That’s not the case for NMake Makefiles. So cmake should rely on cl that it finds in the path. I believe it also applies to Ninja.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use cmake generator "NMake Makefiles" with conan -
If I set environment variable CONAN_CMAKE_GENERATOR to"NMake Makefiles", conan correctly passes -G "NMake Makefiles" to cmake during configure but build ...
Read more >
Cygwin+conan+cmake: how to force use of Ninja?
I have the reason for avoiding MinGW, so the question is: how to force conan+cmake to use ninja instead of "MinGW Makefiles"?? Tried...
Read more >
cmake_paths generator — conan 1.43.4 documentation
This generator is especially useful if you are using CMake based only on the find_package feature to locate the dependencies. The cmake_paths generator...
Read more >
vscode-cmake-tools/support - Gitter
But CMake Tools doesn't seem to like "NMake Makefiles". "Unable to determine what CMake generator to use. Please install or configure a preferred...
Read more >
How to write a proper configurePreset using MinGW compilers ...
... configurePreset using MinGW compilers with "MinGW Makefiles" generator? ... And I tried the following example of CMakePresets.json :.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found