From 94ef1bd2272e49cce1ee3bee06afc38af4261c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 14 Mar 2012 18:38:19 +0000 Subject: [PATCH] [CMAKE] - add a small functions for preprocessing files with C compiler. unused/untested svn path=/trunk/; revision=56149 --- reactos/cmake/CMakeMacros.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index e96eab5d563..f567cd62ef0 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -377,3 +377,19 @@ function(set_module_type MODULE TYPE) # do compiler specific stuff set_module_type_toolchain(${MODULE} ${TYPE}) endfunction() + +function(preprocess_file __in __out) + set(__arg ${__in}) + foreach(__def in ${ARGN}) + list(APPEND __arg -D${__def}) + endforeach() + if(MSVC) + add_custom_command(OUTPUT ${_out} + COMMAND ${CMAKE_C_COMPILER} /EP ${__arg} + DEPENDS ${__in}) + else() + add_custom_command(OUTPUT ${_out} + COMMAND ${CMAKE_C_COMPILER} -E ${__arg} + DEPENDS ${__in}) + endif() +endfunction()