-DNATIVE_C_INCLUDE=${REACTOS_SOURCE_DIR}/include/crt)
endmacro()
-macro(add_dependency_node _node)
+function(add_dependency_node _node)
if(GENERATE_DEPENDENCY_GRAPH)
get_target_property(_type ${_node} TYPE)
if(_type MATCHES SHARED_LIBRARY OR ${_node} MATCHES ntoskrnl)
file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " <node id=\"${_node}\"/>\n")
endif()
endif()
-endmacro()
+endfunction()
-macro(add_dependency_edge _source _target)
+function(add_dependency_edge _source _target)
if(GENERATE_DEPENDENCY_GRAPH)
get_target_property(_type ${_source} TYPE)
if(_type MATCHES SHARED_LIBRARY)
file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " <edge source=\"${_source}\" target=\"${_target}\"/>\n")
endif()
endif()
-endmacro()
+endfunction()
-macro(add_dependency_header)
+function(add_dependency_header)
file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<graphml>\n <graph id=\"ReactOS dependencies\" edgedefault=\"directed\">\n")
-endmacro()
+endfunction()
-macro(add_dependency_footer)
+function(add_dependency_footer)
add_dependency_node(ntdll)
file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " </graph>\n</graphml>\n")
-endmacro()
+endfunction()
-macro(add_message_headers)
+function(add_message_headers)
foreach(_in_FILE ${ARGN})
get_filename_component(FILE ${_in_FILE} NAME_WE)
macro_mc(${FILE})
PROPERTIES GENERATED TRUE)
add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)
endforeach()
-endmacro()
+endfunction()
macro(dir_to_num dir var)
if(${dir} STREQUAL reactos/system32)
if(CMAKE_GENERATOR MATCHES "Unix Makefiles" OR CMAKE_GENERATOR MATCHES "MinGW Makefiles")
set(CLEAN_COMMAND make clean)
elseif(CMAKE_GENERATOR MATCHES "NMake Makefiles")
- set(CLEAN_COMMAND nmake clean)
+ set(CLEAN_COMMAND nmake /nologo clean)
endif()
add_custom_target(${target}_clean
COMMAND ${CLEAN_COMMAND}
string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}")
endmacro()
- macro(concatenate_files _file1 _file2 _output)
+ function(concatenate_files _file1 _file2 _output)
to_win_path("${_file1}" _real_file1)
to_win_path("${_file2}" _real_file2)
to_win_path("${_output}" _real_output)
COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul"
DEPENDS ${_file1}
DEPENDS ${_file2})
- endmacro()
+ endfunction()
else()
macro(concatenate_files _file1 _file2 _output)
add_custom_command(
DEPENDS ${_file2})
endmacro()
endif()
+
+function(add_importlibs _module)
+ add_dependency_node(${_module})
+ foreach(LIB ${ARGN})
+ if ("${LIB}" MATCHES "msvcrt")
+ add_definitions(-D_DLL -D__USE_CRTIMP)
+ target_link_libraries(${_module} msvcrtex)
+ endif()
+ target_link_libraries(${_module} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX})
+ add_dependencies(${_module} lib${LIB})
+ add_dependency_edge(${_module} ${LIB})
+ endforeach()
+endfunction()