Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the CMake command line I used for the build?

Tags:

cmake

This is what typically happens. I get source code that has cmake build scripts. I create a build subdirectory, change to it, run cmake <options> ... Depending upon the project and its dependencies I have to repeat the last step until it finds all necessary dependencies and generates makefiles. I successfully build and use the project. Few days pass, I forget about this installation. Then one day I'm trying to setup the same project on another machine and now I can't recall what exact CMake command line I used in the past to get things working.

I still have the old build directory on the old machine. Can I find the cmake command line I used in the past, by looking into some of the autogenerated files in the build directory? I was expecting CMake would just put the exact command line I used in one of these files in commented form. But if it does so, I haven't found it yet.

How can I find the original CMake command line I used?

like image 477
Jayesh Avatar asked Jul 09 '14 03:07

Jayesh


1 Answers

You can't.

Original CMake command can be guessed from analysis of CMakeCache.txt

As a workaround, you could always create a simple wrapper to store the original command line used. Something along these lines:

#!/bin/bash
echo "$@" > cmake_command.log
$@
like image 151
Peter Avatar answered Oct 17 '22 04:10

Peter