[CMAKE]
authorThomas Faber <thomas.faber@reactos.org>
Sun, 21 Aug 2011 21:18:59 +0000 (21:18 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 21 Aug 2011 21:18:59 +0000 (21:18 +0000)
- Add current source directory to MS RC include paths
- Add include directories to WRC include paths
- Now they should behave identically enough. Thanks to Amine.

svn path=/trunk/; revision=53361

reactos/cmake/gcc.cmake
reactos/cmake/msvc.cmake

index 4b50e42..fd06a5c 100644 (file)
@@ -187,7 +187,7 @@ function(set_rc_compiler)
     #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>"
+    "${WRC} -I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} -i <OBJECT> -o <OBJECT>"
     "<CMAKE_RC_COMPILER> -i <OBJECT> -J res -O coff -o <OBJECT>" PARENT_SCOPE)
 endfunction()
 
index af52304..6c2d452 100644 (file)
@@ -132,7 +132,18 @@ function(set_module_type MODULE TYPE)
 endfunction()
 
 function(set_rc_compiler)
-# dummy, this workaround is only needed in mingw due to lack of RC support in cmake
+    get_directory_property(defines COMPILE_DEFINITIONS)
+    get_directory_property(includes INCLUDE_DIRECTORIES)
+
+    foreach(arg ${defines})
+        set(rc_result_defs "${rc_result_defs} /D${arg}")
+    endforeach()
+
+    foreach(arg ${includes})
+        set(rc_result_incs "/I${arg} ${rc_result_incs}")
+    endforeach()
+
+    set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_result_defs} /I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} /fo <OBJECT> <SOURCE>" PARENT_SCOPE)
 endfunction()
 
 # Thanks MS for creating a stupid linker