[CMake] use of ${cmake_command}

Eric Noulard eric.noulard at gmail.com
Mon Apr 5 17:37:24 EDT 2010


2010/4/5 AKHRES Nader <nader.akhres at laposte.net>:
> Hello,
>
> I've seen some examples where ${CMAKE_COMMAND} is used instead of cmake,
> typically in post build command....
> Is it a better practice for portability?

Yes. This way you can be sure to use the very same 'cmake' that you used
to configure/build the project and not the one found in te path.

In fact you can invoke cmake like that:

cd <yourbuilddir>
/absolute/path/to/my-cmake/cmake <path-source>

my-cmake may be:
   - a git master CMake (i.e. not a release)
   - a patched CMake because you are trying some enhancement not
     yet published upstream
   - an older cmake version 2.4.x because you have to keep your project
     backward compatible
   - a cmake version you installed on your account because you
     do not have enough right on this particular host to upgrade
     system-wide
etc.....


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list