Missing Source and include folder when integrating

2019-09-09 14:01发布

问题:

I am new to CMake and I am trying Integrate CMake with Eclipse.

Below is the example of the file structure that I have.

PROJECT

  • build/linux
  • build/linux/Release (Should contain the release libraries and files)
  • build/linux/Debug (Should contain the debug version of the files)

  • SRC

    1. subProject_1
      .cpp (all source files) and CMakeLists.txt 1 for this folder (creating a static library)
    2. subproject_2
      .cpp (all source files) and CMakeLists.txt 2 for this folder (creating a static library)
    3. subproject_3
      .cpp (all source files) and CMakeLists.txt 3 for this folder (creating the executable)
  • Include

    1. subProject_1
      .h (all the header files)
    2. subProject_2
      .h (all the header files)
    3. subProject_3
      .h (all the header files)

Can you please let me know how would I be able to integrate CMake to Eclipse. I would like to do a in Source build so that I can sub version my code.

I have tried different options of placing the main CMakelist in project folder, project/build/linux folder and so on. I can get the project working but I dont get to see the source folder as well as the include folder on eclipse.

I have tried both 1st and 2nd option specified in http://www.vtk.org/Wiki/CMake:Eclipse_UNIX_Tutorial#CMake_with_Eclipse

回答1:

It's usually very simple: from a clean build directory, you configure cmake using Eclipse as generator (it's easier if you use cmake-gui), and then you import the build directory into Eclipse (File, Import, General, Existing Projects into Workspace).



标签: eclipse cmake