Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know of any variable which provides this information, but you can generate it yourself (with a few provisos).</p> <p>Any <code>-D</code> arguments passed to CMake are added to the cache file <code>CMakeCache.txt</code> in the build directory and are reapplied during subsequent invocations without having to be specified on the command line again.</p> <p>So in your example, if you first execute CMake as</p> <pre><code>cmake ../.. -DCMAKE_INSTALL_PREFIX:PATH=/usr </code></pre> <p>then you will find that subsequently running simply</p> <pre><code>cmake . </code></pre> <p>will still have <code>CMAKE_INSTALL_PREFIX</code> set to <code>/usr</code></p> <p><br/> If what you're looking for from <code>CMAKE_ARGS</code> is the full list of variables defined on the command line from every invocation of CMake then the following should do the trick:</p> <pre><code>get_cmake_property(CACHE_VARS CACHE_VARIABLES) foreach(CACHE_VAR ${CACHE_VARS}) get_property(CACHE_VAR_HELPSTRING CACHE ${CACHE_VAR} PROPERTY HELPSTRING) if(CACHE_VAR_HELPSTRING STREQUAL "No help, variable specified on the command line.") get_property(CACHE_VAR_TYPE CACHE ${CACHE_VAR} PROPERTY TYPE) if(CACHE_VAR_TYPE STREQUAL "UNINITIALIZED") set(CACHE_VAR_TYPE) else() set(CACHE_VAR_TYPE :${CACHE_VAR_TYPE}) endif() set(CMAKE_ARGS "${CMAKE_ARGS} -D${CACHE_VAR}${CACHE_VAR_TYPE}=\"${${CACHE_VAR}}\"") endif() endforeach() message("CMAKE_ARGS: ${CMAKE_ARGS}") </code></pre> <p>This is a bit fragile as it depends on the fact that each variable which has been set via the command line has the phrase "No help, variable specified on the command line." specified as its <code>HELPSTRING</code> property. If CMake changes this default <code>HELPSTRING</code>, you'd have to update the <code>if</code> statement accordingly.</p> <p><br/> If this isn't what you want <code>CMAKE_ARGS</code> to show, but instead only the arguments from the current execution, then I don't think there's a way to do that short of hacking CMake's source code! However, I expect this isn't what you want since all the previous command line arguments are effectively re-applied every time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload