diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index 2de4e281006..66e3034c4af 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -98,7 +98,7 @@ set(CMAKE_RC_COMPILE_OBJECT " -i -J res -O coff -o ") # 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 @@ macro(set_entrypoint MODULE ENTRYPOINT) else() add_linkerflag(${MODULE} "-Wl,-entry,${ENTRYPOINT}") endif() -endmacro() +endfunction() -macro(set_subsystem MODULE SUBSYSTEM) +function(set_subsystem MODULE SUBSYSTEM) add_linkerflag(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}") -endmacro() +endfunction() -macro(set_image_base MODULE IMAGE_BASE) +function(set_image_base MODULE IMAGE_BASE) add_linkerflag(${MODULE} "-Wl,--image-base,${IMAGE_BASE}") -endmacro() +endfunction() -macro(set_module_type MODULE TYPE) +function(set_module_type MODULE TYPE) add_dependencies(${MODULE} psdk) if(${IS_CPP}) @@ -165,14 +165,14 @@ macro(set_module_type MODULE TYPE) 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 @@ macro(set_rc_compiler) set(rc_result_incs "-I${arg} ${rc_result_incs}") endforeach() - #set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${rc_result_incs} -i -O coff -o ") + #set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${rc_result_incs} -i -O coff -o " PARENT_SCOPE) set(CMAKE_RC_COMPILE_OBJECT " -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${rc_result_defs} -I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} -xc -E -o " "${WRC} -I${CMAKE_CURRENT_SOURCE_DIR} -i -o " - " -i -J res -O coff -o ") -endmacro() + " -i -J res -O coff -o " PARENT_SCOPE) +endfunction() #idl files support set(IDL_COMPILER native-widl) @@ -200,19 +200,19 @@ elseif(ARCH MATCHES amd64) 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 @@ macro(add_importlib_target _exports_file) lib${_name}_delayed DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a) -endmacro() +endfunction() -macro(spec2def _dllname _spec_file) +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 @@ macro(spec2def _dllname _spec_file) 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 @@ else() 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 @@ macro(CreateBootSectorTarget _target_name _asm_file _object_file _base_address) DEPENDS ${_asm_file}) set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE) add_custom_target(${_target_name} ALL DEPENDS ${_object_file}) -endmacro() +endfunction() -macro(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address) +function(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address) set(_object_file ${_binary_file}.o) add_custom_command( @@ -394,4 +394,4 @@ macro(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address) add_custom_target(${_target_name} ALL DEPENDS ${_binary_file}) -endmacro() +endfunction()