Note that there are some explanatory texts on larger screens.

plurals
  1. POExecute command or macro in CMake as last step before 'Configure' step finishes
    primarykey
    data
    text
    <p>Is it somehow possible with CMake (version >= 2.8.7) to execute a macro or command as a last step before the configuration phase finishes?</p> <p>The functionality should be executed before the following lines get printed on screen:</p> <pre><code>-- Configuring done -- Generating done </code></pre> <p>Up to now I wasn't able to find a CMake target which could be used as a dependency to achieve this with <code>add_custom_command</code> <code>add_custom_target</code> or <code>add_dependencies</code>.</p> <p>EDIT: We have a library exporting several CMake macros and some of these macros must be executed at the end of each <code>CMakeLists.txt</code> file after all other CMake commands were run. Ideally the desired behavior can be achieved by including a file <code>macros.cmake</code> in a <code>CMakeLists.txt</code> file without the necessity to add an additional command at the end of this <code>CMakeLists.txt</code> file.</p> <p>It would also be possible to achieve this by gathering all functionality in one macro which needs to be called explicitely at the end of the <code>CMakeLists.txt</code>. However, there are already several dependent libraries which would need to be adapted and a solution to this problem would omit this additional work. Also, adding the macro can be forgotten or the requirement for it being the very last statement can be easily violated.</p> <p>Example <code>macros.cmake</code>:</p> <pre><code>macro(FINAL_MACRO) message(STATUS "Last step before finishing Configure phase") endmacro() # HERE: something like add_custom_target(final_steps) # followed by something like add_dependencies(final_steps cmake_configure_finished) </code></pre> <p>Example toplevel <code>CMakeLists.txt</code>:</p> <pre><code>cmake_minimum_required(VERSION 2.8.7) include(macros.cmake) add_subdirectory(source) add_subdirectory(interfaces) # here FINAL_MACRO should get executed without explicitely writing it down </code></pre> <p>If there is no other option we will have to require every user to call a special macro at the end of their <code>CMakeLists.txt</code> file.</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.
 

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