mwyburd
mwyburd

Reputation: 13

Can someone expand what is meant by 'configure' and 'build' with CMake files

I am downloading this code from GitHub (subdivision-regression), and am getting stuck following the instructions:

To build doosabin_regression:

    Run CMake with an out of source build.
    Set COMMON_CPP_INCLUDE_DIR to the full path to rstebbing/common/cpp.
    Set DOOSABIN_INCLUDE_DIR to the full path to rstebbing/subdivision/cpp/doosabin/include.
    Set Ceres_DIR to the directory containing CeresConfig.cmake.
    Set GFLAGS_INCLUDE_DIR, GFLAGS_LIBRARY and RAPID_JSON_INCLUDE_DIR. (Add -std=c++11 to CMAKE_CXX_FLAGS if compiling with gcc.)
    Configure.
    Build.

I have edited the CMakeLists.txt file to put the correct paths in. I then created a new directory called subdivision-regression-bin and ran:

cmake ../subdivision-regression/src

It completes this and displays:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/hert5584/RStebbing/subdivision-regression-bin

However, when I try and run the example code, it cannot find the files listed in CMakeLists.txt (I know they are the right paths as otherwise CMake does not run).

I have tried running:

sudo make install 

But get the following error:

make: *** No rule to make target 'install'. Stop.

Any ideas why this isn't working? Have the above steps Configured and Built the files?

Upvotes: 1

Views: 1760

Answers (1)

Kevin
Kevin

Reputation: 18243

The ordered CMake idiom to understand is:

  1. The Configure step
  2. The Generate step (This is often subsumed in the Configure step, and not mentioned explicitly, as in this case.)
  3. The Build step (in which you actually compile/link your code into libraries/executables)

Take a look at this resource for information about the configure and generate stages.

You didn't appear to perform the steps to set CMake cache variables. For these you have to use CMake command line options (-D specifically). So run CMake as something like this instead to set all six variables:

cmake -DCOMMON_CPP_INCLUDE_DIR=/rstebbing/common/cp -DDOOSABIN_INCLUDE_DIR=...[More CMake Cache variables]...  ../subdivision-regression/src

For building, try just running make without sudo or install:

make

Upvotes: 2

Related Questions