Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get cmake command from cmake-gui?

Tags:

cmake

I use cmake-gui to configure OpenCV, and I want to use same configure on some other computer.
Cause I use ssh without X forwarding, so I can't use cmake-gui to configure again.
I don't kown how to use cmake to complete my configure, so I wonder that cmake-gui can generate the command use for cmake?
Is there anyway to do this?

like image 533
Gianluigi Avatar asked Feb 23 '13 08:02

Gianluigi


2 Answers

There is an option called: Tools-> Show my Changes which displays exactly what you have configured relating to the original configuration. One version are the copy&paste command line parameters and the other version is nicely human readable.

like image 194
Cutton Eye Avatar answered Nov 10 '22 08:11

Cutton Eye


By default you cannot do what you want because that path is stored in CMAKE_COMMAND which is an INTERNAL variable so it is not visible in the GUI. You can manually read it from the cache using a command like grep CMAKE_COMMAND CMakeCache.txt | cut -d = -f 2. Alternatively you can update your CMakeLists.txt to put the value of CMAKE_COMMAND in the cache so that you can read it using the GUI. For example:

set(USED_CMAKE_PATH ${CMAKE_COMMAND} CACHE FILEPATH
    "The path to the CMake executable used to configure this project" FORCE)

Additionally if you are using the "Unix Makefiles" generator there are two targets provided for this:

  • rebuild_cace which is equivalent to cmake .
  • edit_cache which is equivalent to ccmake . or cmake-gui . depending upon your install.

Note: I used CMake version 2.8.10.2 to test this, but I expect it to work with any version.

like image 23
j3lamp Avatar answered Nov 10 '22 06:11

j3lamp