How to configure Eclipse CDT for cmake?

后端 未结 7 1313
生来不讨喜
生来不讨喜 2020-11-30 22:30

How to configure Eclipse \"Helios\" with plugin CDT for cmake?

cmake all 
CMake Error: The source directory \"D:/javaworkspace/workspace/Planner/Debug/all\"          


        
7条回答
  •  情歌与酒
    2020-11-30 23:23

    In Eclipse-CDT you do not create cmake projects but you import cmake projects. This is what you should do:

    1. Say the source of your CMake project named "Planner" is located in D:/javaworkspace/src/Planner

    2. Create a folder (the folders NEED to be parallel to each other): D:/javaworkspace/build/Planner

    3. Go to the folder D:/javaworkspace/build/Planner and run CMake using the Eclipse generator:

       cmake ../../src/Planner -G"Eclipse CDT4 - Unix Makefiles"
      

      This will generate the make files for your Planner project.

    4. To import this in Eclipse do the following:

      File -> Import -> C/C++ -> Existing code as Makefile project

      and select D:/javaworkspace/build/Planner (the build output folder with the make files) as the "Existing Code location"

    However, looking at your paths it seems to me that you are working on Windows. In windows CMake can generate Visual Studio projects. If you want to use CMake I suggest first creating a "hello world" project using CMake (remember, Eclipse does not create CMake projects, you have to create a CMakeLists.txt file by hand)

提交回复
热议问题