[FREELDR][SDK:CMAKE] Move the `MSVC "linker script" file' functionality out of FreeLd...
[reactos.git] / sdk / cmake / gcc.cmake
index da203e5..4c83f50 100644 (file)
@@ -452,7 +452,6 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
     set_source_files_properties(${_object_file} ${_binary_file} PROPERTIES GENERATED TRUE)
 
     add_custom_target(${_target_name} ALL DEPENDS ${_binary_file})
     set_source_files_properties(${_object_file} ${_binary_file} PROPERTIES GENERATED TRUE)
 
     add_custom_target(${_target_name} ALL DEPENDS ${_binary_file})
-
 endfunction()
 
 function(allow_warnings __module)
 endfunction()
 
 function(allow_warnings __module)
@@ -463,3 +462,12 @@ endfunction()
 macro(add_asm_files _target)
     list(APPEND ${_target} ${ARGN})
 endmacro()
 macro(add_asm_files _target)
     list(APPEND ${_target} ${ARGN})
 endmacro()
+
+function(add_linker_script _target _linker_script_file)
+    get_filename_component(_file_full_path ${_linker_script_file} ABSOLUTE)
+    add_target_link_flags(${_target} "-Wl,-T,${_file_full_path}")
+
+    # Unfortunately LINK_DEPENDS is ignored in non-Makefile generators (for now...)
+    # See also http://www.cmake.org/pipermail/cmake/2010-May/037206.html
+    add_target_property(${_target} LINK_DEPENDS ${_file_full_path})
+endfunction()