Author: tkreuzer Date: Fri Feb 13 20:19:51 2015 New Revision: 66250 URL: http://svn.reactos.org/svn/reactos?rev=66250&view=rev Log: [CMAKE] Add support for "module groups". These are meta targets that automatically include all targets using set_module_type() that are included between start_module_group(name) and end_module_group().
Modified: trunk/reactos/cmake/CMakeMacros.cmake Modified: trunk/reactos/cmake/CMakeMacros.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?rev=66250&r1=66249&r2=66250&view=diff ============================================================================== --- trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Fri Feb 13 20:19:51 2015 @@ -550,9 +550,14 @@ message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}") endif() + # Add the module to the module group list, if it is defined + if(DEFINED CURRENT_MODULE_GROUP) + set_property(GLOBAL APPEND PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST "${MODULE}") + endif() + # Set subsystem. Also take this as an occasion # to error out if someone gave a non existing type - if((${TYPE} STREQUAL nativecui) OR (${TYPE} STREQUAL nativedll) + if((${TYPE} STREQUAL nativecui) OR (${TYPE} STREQUAL nativedll) OR (${TYPE} STREQUAL kernelmodedriver) OR (${TYPE} STREQUAL wdmdriver) OR (${TYPE} STREQUAL kerneldll)) set(__subsystem native) elseif(${TYPE} STREQUAL win32cui) @@ -662,6 +667,21 @@ # do compiler specific stuff set_module_type_toolchain(${MODULE} ${TYPE}) +endfunction() + +function(start_module_group __name) + if(DEFINED CURRENT_MODULE_GROUP) + message(FATAL_ERROR "CURRENT_MODULE_GROUP is already set ('${CURRENT_MODULE_GROUP}')") + endif() + set(CURRENT_MODULE_GROUP rostests PARENT_SCOPE) +endfunction() + +function(end_module_group) + get_property(__modulelist GLOBAL PROPERTY ${CURRENT_MODULE_GROUP}_MODULE_LIST) + add_custom_target(${CURRENT_MODULE_GROUP}) + foreach(__module ${__modulelist}) + add_dependencies(${CURRENT_MODULE_GROUP} ${__module}) + endforeach() endfunction() function(preprocess_file __in __out)