[CMAKE]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 8 Jan 2011 20:44:41 +0000 (20:44 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 8 Jan 2011 20:44:41 +0000 (20:44 +0000)
- Improve message headers handling.

svn path=/branches/cmake-bringup/; revision=50334

CMakeMacros.cmake
base/applications/rapps/CMakeLists.txt
gcc.cmake
include/reactos/mc/CMakeLists.txt
msc.cmake

index a1a754b..95fc7be 100644 (file)
@@ -268,3 +268,19 @@ endmacro()
 macro(add_dependency_footer)\r
     file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "  </graph>\n</graphml>\n")\r
 endmacro()\r
+\r
+macro(add_message_headers)\r
+    foreach(_in_FILE ${ARGN})\r
+        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
+        macro_mc(${FILE})\r
+        add_custom_command(\r
+            OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h\r
+            COMMAND ${COMMAND_MC}\r
+            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc)\r
+        set_source_files_properties(\r
+            ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc\r
+            PROPERTIES GENERATED TRUE)\r
+        add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)\r
+    endforeach()\r
+endmacro()\r
+\r
index 3c99743..f49f70d 100644 (file)
@@ -19,8 +19,10 @@ list(APPEND SOURCE
     winmain.c
     rapps.rc)
 
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-include_directories(${REACTOS_BINARY_DIR}/include/reactos)
+include_directories(
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${REACTOS_BINARY_DIR}/include/reactos)
+
 set_rc_compiler()
 
 add_executable(rapps ${SOURCE})
@@ -29,40 +31,5 @@ target_link_libraries(rapps uuid)
 
 add_importlibs(rapps advapi32 comctl32 gdi32 urlmon user32 shell32 shlwapi kernel32 msvcrt ntdll)
 add_dependencies(rapps rappsmsg)
-
-#FIXME : move this to cmakemacros + gcc/msvc.cmake
-
-if(MSVC)
-MACRO(MACRO_MC FILE)
-    set (COMMAND_MC mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc)
-ENDMACRO()
-else()
-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)
-ENDMACRO()
-endif()
-
-MACRO (MACRO_ADD_MESSAGE_HEADERS)
-
-  FOREACH(_in_FILE ${ARGN})
-
-    get_filename_component(FILE ${_in_FILE} NAME_WE)
-    MACRO_MC(${FILE})
-    add_custom_command(
-      OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h
-      COMMAND ${COMMAND_MC}
-      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc
-    )
-    set_source_files_properties(
-      ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc
-      PROPERTIES GENERATED TRUE
-    )
-    add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)
-
-  ENDFOREACH(_in_FILE ${ARGN})
-
-ENDMACRO (MACRO_ADD_MESSAGE_HEADERS)
-
-MACRO_ADD_MESSAGE_HEADERS(rappsmsg.mc)
-
+add_message_headers(rappsmsg.mc)
 add_cab_target(rapps 1)
index 06c6c06..149cb35 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -273,6 +273,10 @@ macro(spec2def _dllname _spec_file)
     list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c)
 endmacro()
 
+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)
+endmacro()
+
 #pseh lib, needed with mingw
 set(PSEH_LIB "pseh")
 
index 2dc31a8..ef6bc8e 100644 (file)
@@ -1,39 +1,9 @@
 
-if(MSVC)
-macro(MACRO_MC FILE)
-    set (COMMAND_MC mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos ${REACTOS_SOURCE_DIR}/include/reactos/mc/${FILE}.mc)
-endmacro()
-else()
-macro(MACRO_MC FILE)
-    set(COMMAND_MC ${MINGW_PREFIX}windmc -A -b ${REACTOS_SOURCE_DIR}/include/reactos/mc/${FILE}.mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos)
-endmacro()
-endif()
-
-macro (MACRO_ADD_MESSAGE_HEADERS)
-
-  foreach(_in_FILE ${ARGN})
-
-    get_filename_component(FILE ${_in_FILE} NAME_WE)
-    MACRO_MC(${FILE})
-    add_custom_command(
-      OUTPUT ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h
-      COMMAND ${COMMAND_MC}
-      DEPENDS ${REACTOS_SOURCE_DIR}/include/reactos/mc/${FILE}.mc
-    )
-    set_source_files_properties(
-      ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc
-      PROPERTIES GENERATED TRUE
-    )
-    add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc)
-
-  endforeach(_in_FILE ${ARGN})
-
-endmacro (MACRO_ADD_MESSAGE_HEADERS)
-
 list(APPEND SOURCE
     bugcodes.mc
     errcodes.mc
     neteventmsg.mc
     ntstatus.mc
     pciclass.mc)
-MACRO_ADD_MESSAGE_HEADERS(${SOURCE})
+
+add_message_headers(${SOURCE})
index a419ada..cf12241 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -204,6 +204,10 @@ macro(set_export_spec _module _spec_file)
     spec2def(${_dllname} ${_spec_file})\r
 endmacro()\r
 \r
+macro(macro_mc FILE)\r
+    set(COMMAND_MC mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos ${REACTOS_SOURCE_DIR}/include/reactos/mc/${FILE}.mc)\r
+endmacro()\r
+\r
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)\r
 \r
 #pseh workaround\r