Author: akhaldi
Date: Mon Aug 8 11:45:34 2011
New Revision: 53136
URL:
http://svn.reactos.org/svn/reactos?rev=53136&view=rev
Log:
[CMAKE]
* Convert some macros to functions.
Modified:
trunk/reactos/cmake/gcc.cmake
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=53136&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Mon Aug 8 11:45:34 2011
@@ -98,7 +98,7 @@
"<CMAKE_RC_COMPILER> -i <OBJECT> -J res -O coff -o
<OBJECT>")
# Optional 3rd parameter: stdcall stack bytes
-macro(set_entrypoint MODULE ENTRYPOINT)
+function(set_entrypoint MODULE ENTRYPOINT)
if(${ENTRYPOINT} STREQUAL "0")
add_linkerflag(${MODULE} "-Wl,-entry,0")
elseif(ARCH MATCHES i386)
@@ -110,17 +110,17 @@
else()
add_linkerflag(${MODULE} "-Wl,-entry,${ENTRYPOINT}")
endif()
-endmacro()
-
-macro(set_subsystem MODULE SUBSYSTEM)
+endfunction()
+
+function(set_subsystem MODULE SUBSYSTEM)
add_linkerflag(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}")
-endmacro()
-
-macro(set_image_base MODULE IMAGE_BASE)
+endfunction()
+
+function(set_image_base MODULE IMAGE_BASE)
add_linkerflag(${MODULE} "-Wl,--image-base,${IMAGE_BASE}")
-endmacro()
-
-macro(set_module_type MODULE TYPE)
+endfunction()
+
+function(set_module_type MODULE TYPE)
add_dependencies(${MODULE} psdk)
if(${IS_CPP})
@@ -165,14 +165,14 @@
add_dependencies(${MODULE} bugcodes)
elseif(${TYPE} MATCHES nativedll)
set_subsystem(${MODULE} native)
- set_entrypoint(${MODULE} DllMain 12)
+ set_entrypoint(${MODULE} DllMain 12)
else()
message(FATAL_ERROR "Unknown module type : ${TYPE}")
endif()
-endmacro()
+endfunction()
# Workaround lack of mingw RC support in cmake
-macro(set_rc_compiler)
+function(set_rc_compiler)
get_directory_property(defines COMPILE_DEFINITIONS)
get_directory_property(includes INCLUDE_DIRECTORIES)
@@ -184,12 +184,12 @@
set(rc_result_incs "-I${arg} ${rc_result_incs}")
endforeach()
- #set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_result_defs}
${rc_result_incs} -i <SOURCE> -O coff -o <OBJECT>")
+ #set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_result_defs}
${rc_result_incs} -i <SOURCE> -O coff -o <OBJECT>" PARENT_SCOPE)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_C_COMPILER> -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1
${rc_result_defs} -I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} -xc -E <SOURCE> -o
<OBJECT>"
"${WRC} -I${CMAKE_CURRENT_SOURCE_DIR} -i <OBJECT> -o <OBJECT>"
- "<CMAKE_RC_COMPILER> -i <OBJECT> -J res -O coff -o
<OBJECT>")
-endmacro()
+ "<CMAKE_RC_COMPILER> -i <OBJECT> -J res -O coff -o
<OBJECT>" PARENT_SCOPE)
+endfunction()
#idl files support
set(IDL_COMPILER native-widl)
@@ -200,19 +200,19 @@
set(IDL_FLAGS -m64 --win64)
endif()
-macro(add_delay_importlibs MODULE)
+function(add_delay_importlibs MODULE)
foreach(LIB ${ARGN})
target_link_libraries(${MODULE}
${CMAKE_BINARY_DIR}/importlibs/lib${LIB}_delayed.a)
add_dependencies(${MODULE} lib${LIB}_delayed)
endforeach()
target_link_libraries(${MODULE} delayimp)
-endmacro()
+endfunction()
if(NOT ARCH MATCHES i386)
set(DECO_OPTION "-@")
endif()
-macro(add_importlib_target _exports_file)
+function(add_importlib_target _exports_file)
get_filename_component(_name ${_exports_file} NAME_WE)
get_filename_component(_extension ${_exports_file} EXT)
@@ -265,9 +265,9 @@
lib${_name}_delayed
DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a)
-endmacro()
-
-macro(spec2def _dllname _spec_file)
+endfunction()
+
+function(spec2def _dllname _spec_file)
get_filename_component(_file ${_spec_file} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
@@ -276,7 +276,7 @@
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c PROPERTIES
GENERATED TRUE)
-endmacro()
+endfunction()
macro(macro_mc FILE)
set(COMMAND_MC ${MINGW_PREFIX}windmc -A -b ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc -r
${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos)
@@ -353,7 +353,7 @@
endmacro()
endif()
-macro(CreateBootSectorTarget _target_name _asm_file _object_file _base_address)
+function(CreateBootSectorTarget _target_name _asm_file _object_file _base_address)
get_filename_component(OBJECT_PATH ${_object_file} PATH)
get_filename_component(OBJECT_NAME ${_object_file} NAME)
file(MAKE_DIRECTORY ${OBJECT_PATH})
@@ -374,9 +374,9 @@
DEPENDS ${_asm_file})
set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE)
add_custom_target(${_target_name} ALL DEPENDS ${_object_file})
-endmacro()
-
-macro(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address)
+endfunction()
+
+function(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address)
set(_object_file ${_binary_file}.o)
add_custom_command(
@@ -394,4 +394,4 @@
add_custom_target(${_target_name} ALL DEPENDS ${_binary_file})
-endmacro()
+endfunction()