Is it possible with CMake (version> = 2.8.7) to execute a macro or command as the last step until the configuration phase is complete?
Functionality must be completed before the following lines are printed on the screen:
-- Configuring done -- Generating done
So far, I have not been able to find a CMake goal that could be used as a dependency to achieve this goal using add_custom_command add_custom_target or add_dependencies .
EDIT: We have a library that exports several CMake macros, and some of these macros must be executed at the end of each CMakeLists.txt file after all other CMake commands have been executed. Ideally, the desired behavior can be achieved by including the macros.cmake file in the CMakeLists.txt file without the need to add an additional command at the end of this CMakeLists.txt file.
It would also be possible to achieve this by collecting all the functionality in one macro, which must be explicitly named at the end of CMakeLists.txt . However, there are already several dependent libraries that will need to be adapted, and solving this problem would skip this extra work. In addition, adding a macro may be forgotten, or the requirement that it be the most recent statement can be easily violated.
macros.cmake example:
macro(FINAL_MACRO) message(STATUS "Last step before finishing Configure phase") endmacro()
Top-level example of CMakeLists.txt :
cmake_minimum_required(VERSION 2.8.7) include(macros.cmake) add_subdirectory(source) add_subdirectory(interfaces)
If there is no other option, we will have to require each user to call a special macro at the end of their CMakeLists.txt file.
cmake
MKroehnert Apr 02 '13 at 9:28 2013-04-02 09:28
source share