Search code examples
eclipsecmakeeclipse-cdt

Creating Eclipse CDT using CMake on Windows


I am trying to create a simple helloworld Eclipse CDT project using the CMake GUI. The CMake file looks like this:

cmake_minimum_required(VERSION "3.11.1")

project("HelloWorld")

add_executable("HelloWorldMain" "Main.cpp")

install(TARGETS "${PROJECT_NAME}" DESTINATION bin)
install(FILES "Main.cpp" DESTINATION src)

The only c/c++ compiler I have is MSVC so I set that as the CMAKE_CXX_COMPILER but I get an error when configuring as shown here:

enter image description here

I know this file exists, but how do I get it to find it?


Solution

  • I ended up not using the GUI. Instead I used the VS x64 Native Tools Command Prompt then ran the cmake command:

    cmake -G "Eclipse CDT4 - NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../