How to recompile a single .cc file in a project built previously with CMake tool in Ubuntu 20.04?

185 views Asked by At

I am using the ORB_SLAM3 project (https://github.com/UZ-SLAMLab/ORB_SLAM3) as a baseline for a monocular odometry system.

To understand how the ORB_SLAM3 software ingests the EuRoCV dataset, I am modifying some of the initial codes in the mono_euroc.cc file available in /Examples/Monocular folder.

However, each time I change the .cc file, I cannot compile just the mono_euroc.cc file by itself, but need to run the ./build.sh command from the parent directory which executes the entire CMake. The process which takes a while to complete.

My question is, is there a tool within CMake that would allow me to only change the "mono_euroc.cc" file directly from the "/Examples/Monocular" subdirectory rather than having to constantly invoke the "./build.sh" from the parent directory?

1

There are 1 answers

0
Azmyin Md. Kamal On BEST ANSWER

For the time being, I am following this process. I opened two terminal windows, both pointing to the parent directory (i.e ~/Dev/ORB_SLAM3). Everytime I change something in the target file (here it is the ./Examples/Monocular/euroc_mono) I execture the ./build.sh command in one and run the file on the other. I can confirm that though the cmake command looks over all the files, it only builds the one that was changed. I guess this method works when one is using the CMake tool to build a C++ project in Linux.