0

I am trying build project via CMake, few days earlier this process worked fine, but today I am getting error after command cmake -G "NMake Makefiles" .. :

CMake Error at CMakeLists.txt:8 (project):
  Running

   'nmake' '-?'

  failed with:

   The system cannot find the specified file 


-- Configuring incomplete, errors occurred!

I am using Visual Studio Code, name of project folder is "ADC_read", and my CMakeLists.txt file is:

# Set minimum required version of CMake
cmake_minimum_required(VERSION 3.12)

# Include build functions from Pico SDK
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)

# Set name of project (as PROJECT_NAME) and C/C   standards
project(ADC_read C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

# Creates a pico-sdk subdirectory in our project for the libraries
pico_sdk_init()

# Tell CMake where to find the executable source file
add_executable(${PROJECT_NAME} 
    main.c
)

# Create map/bin/hex/uf2 files
pico_add_extra_outputs(${PROJECT_NAME})

# Link to pico_stdlib (gpio, time, etc. functions)
target_link_libraries(${PROJECT_NAME} 
    pico_stdlib adc_read hardware_adc
)


# Enable usb output, disable uart output
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)

Anyone know where could be problem?

==========================% EDIT %=============================== Semisolved...

So I am still not able to build project from Visual Studio Code (VSC can´t find nmake), but building from VS command prompt works fine, so I will stick with this.

Artii
  • 1
  • 1
  • By specifying option `-G "NMake Makefiles"` you tell CMake that you want to build your project via `nmake`. But the error message tells that you don't have `nmake` installed. If you want to build the project with Visual Studio, then select proper generator from that list: https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators – Tsyvarev Oct 29 '21 at 15:48
  • @TsyvarevI I thought nmake was part of Visual Studio, so how it's possible I don't have nmake installed?? – Artii Oct 29 '21 at 17:15
  • @Tsyvarev ok so I have another maybe stupid question. I didn't find how to install `nmake`, is then `nmake` part of CMake (which I have installed)? – Artii Oct 29 '21 at 17:46
  • Hm, I was not very correct in my previous comment: `nmake` is (in some extent) a part of Visual Studio: https://stackoverflow.com/questions/35507646/nmake-exe-is-not-found-in-the-windows-system32-folder-how-to-setup-nmake-comman. But do you **actually** have Visual Studio installed? Note, that Visual Studio and Visual Studio Code are very different things. – Tsyvarev Oct 29 '21 at 17:54
  • @Tsyvarev yes, I have installed Visual Studio 2019. And as I writted in question, command `cmake -G "NMake Makefiles"` worked fine few days before and I did make no changes since that. – Artii Oct 29 '21 at 18:13

1 Answers1

0

Try removing your CMakeCache.txt file, as it holds your previous generator data. You can then recompile your project with cmake and it should work !

Akai
  • 1