[CMAKE]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 3 Sep 2011 18:59:14 +0000 (18:59 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 3 Sep 2011 18:59:14 +0000 (18:59 +0000)
- Replace add_linkerflag and add_compiler_flags with their new equivalents add_target_link_flags/add_compile_flags
- Remove those now obsolete macros
- Use the new set_module_type to get rid of evil hacks for drivers without entry point (wmilib, drmk)

svn path=/trunk/; revision=53558

15 files changed:
reactos/CMakeLists.txt
reactos/cmake/compilerflags.cmake
reactos/dll/3rdparty/mesa32/CMakeLists.txt
reactos/dll/ntdll/CMakeLists.txt
reactos/dll/win32/browseui/CMakeLists.txt
reactos/dll/win32/msvcrt/CMakeLists.txt
reactos/dll/win32/msvcrt20/CMakeLists.txt
reactos/dll/win32/msvcrt40/CMakeLists.txt
reactos/dll/win32/msxml3/CMakeLists.txt
reactos/dll/win32/windowscodecs/CMakeLists.txt
reactos/drivers/wdm/audio/drm/drmk/CMakeLists.txt
reactos/drivers/wmi/CMakeLists.txt
reactos/lib/3rdparty/mingw/CMakeLists.txt
reactos/lib/newinflib/CMakeLists.txt
reactos/lib/sdk/crt/msvcrtex.cmake

index bd47278..f96d129 100644 (file)
@@ -52,7 +52,7 @@ if(NOT CMAKE_CROSSCOMPILING)
         endif()
         add_definitions(/Dinline=__inline)
     else()
         endif()
         add_definitions(/Dinline=__inline)
     else()
-        add_compiler_flags(-fshort-wchar)
+        add_compile_flags("-fshort-wchar")
     endif()
 
     include_directories(include/host)
     endif()
 
     include_directories(include/host)
index 5d3ece6..c5cc19a 100644 (file)
@@ -24,33 +24,8 @@ function(add_target_property _module _propname)
     set_property(TARGET ${_module} PROPERTY ${_propname} ${_newvalue})
 endfunction()
 
     set_property(TARGET ${_module} PROPERTY ${_propname} ${_newvalue})
 endfunction()
 
-#
-# For backwards compatibility. To be removed soon.
-#
-function(add_compiler_flags)
-    set(flags_list "")
-    # Adds the compiler flag to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
-    foreach(flag ${ARGN})
-        set(flags_list "${flags_list} ${flag}")
-    endforeach()
-
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flags_list}" PARENT_SCOPE)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flags_list}" PARENT_SCOPE)
-endfunction()
-
-function(add_linkerflag MODULE _flag)
-    if (${ARGC} GREATER 2)
-        message(STATUS "Excess arguments to add_linkerflag! Module ${MODULE}, args ${ARGN}")
-    endif()
-    set(NEW_LINKER_FLAGS ${_flag})
-    get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS)
-    if(LINKER_FLAGS)
-        set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}")
-    endif()
-    set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS})
-endfunction()
-
-# New versions, using add_target_property where appropriate.
+# Wrapper functions for the important properties, using add_target_property
+# where appropriate.
 # Note that the functions for string properties take a single string
 # argument while those for list properties can take a variable number of
 # arguments, all of which will be added to the list
 # Note that the functions for string properties take a single string
 # argument while those for list properties can take a variable number of
 # arguments, all of which will be added to the list
@@ -59,7 +34,7 @@ endfunction()
 #  add_compile_flags("-pedantic -O5")
 #  add_target_link_flags(mymodule "-s --fatal-warnings")
 #  add_target_compile_flags(mymodule "-pedantic -O5")
 #  add_compile_flags("-pedantic -O5")
 #  add_target_link_flags(mymodule "-s --fatal-warnings")
 #  add_target_compile_flags(mymodule "-pedantic -O5")
-#  add_target_compile_definitions(mymodule WIN32 _WIN32)
+#  add_target_compile_definitions(mymodule WIN32 _WIN32 INLINE=inline)
 #  add_target_include_directories(mymodule include ../include)
 function(add_compile_flags _flags)
     if (${ARGC} GREATER 1)
 #  add_target_include_directories(mymodule include ../include)
 function(add_compile_flags _flags)
     if (${ARGC} GREATER 1)
index 978f891..32cf70f 100644 (file)
@@ -1,6 +1,6 @@
 
 if(NOT MSVC)
 
 if(NOT MSVC)
-    add_compiler_flags(-w)
+    add_compile_flags("-w")
 endif()
 
 add_definitions(
 endif()
 
 add_definitions(
index 5315a55..65e543b 100644 (file)
@@ -39,7 +39,7 @@ add_library(ntdll SHARED ${SOURCE})
 set_module_type(ntdll win32dll ENTRYPOINT 0)
 
 if(MSVC)
 set_module_type(ntdll win32dll ENTRYPOINT 0)
 
 if(MSVC)
-    add_linkerflag(ntdll /RELEASE)
+    add_target_link_flags(ntdll "/RELEASE")
 endif()
 
 target_link_libraries(ntdll
 endif()
 
 target_link_libraries(ntdll
index 12d9899..9748f17 100644 (file)
@@ -7,7 +7,7 @@ add_definitions(
     -DROS_Headers)
 
 if (MSVC)
     -DROS_Headers)
 
 if (MSVC)
-    add_compiler_flags(/EHa-)
+    add_compile_flags("/EHa-")
 endif()
 
 remove_definitions(-D_WIN32_WINNT=0x502)
 endif()
 
 remove_definitions(-D_WIN32_WINNT=0x502)
index 9a3a1f0..6a5987b 100644 (file)
@@ -31,7 +31,7 @@ target_link_libraries(msvcrt crt wine ${PSEH_LIB})
 
 if(MSVC)
     # export of deleting destructor "name"
 
 if(MSVC)
     # export of deleting destructor "name"
-    add_linkerflag(msvcrt "/ignore:4102")
+    add_target_link_flags(msvcrt "/ignore:4102")
 endif()
 
 add_importlibs(msvcrt kernel32 ntdll)
 endif()
 
 add_importlibs(msvcrt kernel32 ntdll)
index 2de205c..dc114a5 100644 (file)
@@ -28,7 +28,7 @@ target_link_libraries(msvcrt20 crt wine ${PSEH_LIB})
 
 if(MSVC)
     # export of deleting destructor "name"
 
 if(MSVC)
     # export of deleting destructor "name"
-    add_linkerflag(msvcrt20 "/ignore:4102")
+    add_target_link_flags(msvcrt20 "/ignore:4102")
 endif()
 
 add_importlibs(msvcrt20 kernel32 ntdll)
 endif()
 
 add_importlibs(msvcrt20 kernel32 ntdll)
index cd26247..7b4e548 100644 (file)
@@ -29,7 +29,7 @@ target_link_libraries(msvcrt40 crt wine ${PSEH_LIB})
 
 if(MSVC)
     # export of deleting destructor "name"
 
 if(MSVC)
     # export of deleting destructor "name"
-    add_linkerflag(msvcrt40 "/ignore:4102")
+    add_target_link_flags(msvcrt40 "/ignore:4102")
 endif()
 
 add_importlibs(msvcrt40 kernel32 ntdll)
 endif()
 
 add_importlibs(msvcrt40 kernel32 ntdll)
index bfa9239..4b8102a 100644 (file)
@@ -11,7 +11,7 @@ add_definitions(
     -DLIBXML_STATIC)
 
 if(MSVC)
     -DLIBXML_STATIC)
 
 if(MSVC)
-    add_compiler_flags(/FIwine/typeof.h /FImsvc.h)
+    add_compile_flags("/FIwine/typeof.h /FImsvc.h")
 endif(MSVC)
 
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 endif(MSVC)
 
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
index d99a32c..a0165d3 100644 (file)
@@ -13,7 +13,7 @@ include_directories(
 set_rc_compiler()
 
 if(MSVC)
 set_rc_compiler()
 
 if(MSVC)
-    add_compiler_flags(/FItypeof.h)
+    add_compile_flags("/FItypeof.h")
 endif()
 
 spec2def(windowscodecs.dll windowscodecs.spec)
 endif()
 
 spec2def(windowscodecs.dll windowscodecs.spec)
index eb70b99..5026ba7 100644 (file)
@@ -10,18 +10,8 @@ list(APPEND SOURCE
 
 add_library(drmk SHARED ${SOURCE})
 
 
 add_library(drmk SHARED ${SOURCE})
 
-if(NOT MSVC)
-    set_module_type(drmk kernelmodedriver)
-else()
-    set_target_properties(drmk PROPERTIES SUFFIX ".sys")
-    set_subsystem(drmk native)
-    set_image_base(drmk 0x00010000)
-    add_linkerflag(drmk "/DRIVER")
-    add_dependencies(drmk bugcodes)
-    add_dependencies(drmk psdk)
-endif()
+set_module_type(drmk kernelmodedriver ENTRYPOINT 0)
 
 
-set_entrypoint(drmk 0)
 add_importlibs(drmk ntoskrnl)
 add_importlib_target(drmk.spec)
 add_cd_file(TARGET drmk DESTINATION reactos/system32/drivers FOR all)
 add_importlibs(drmk ntoskrnl)
 add_importlib_target(drmk.spec)
 add_cd_file(TARGET drmk DESTINATION reactos/system32/drivers FOR all)
index c00a650..c672950 100644 (file)
@@ -8,19 +8,8 @@ list(APPEND SOURCE
 
 add_library(wmilib SHARED ${SOURCE})
 
 
 add_library(wmilib SHARED ${SOURCE})
 
-if(NOT MSVC)
-    set_module_type(wmilib kernelmodedriver)
-else()
-    set_target_properties(wmilib PROPERTIES SUFFIX ".sys")
-    set_subsystem(wmilib native)
-    set_image_base(wmilib 0x00010000)
-    add_linkerflag(wmilib "/DRIVER")
-    add_dependencies(wmilib bugcodes)
-    add_dependencies(wmilib psdk)
-endif()
+set_module_type(wmilib kernelmodedriver ENTRYPOINT 0)
 
 
-set_entrypoint(wmilib 0)
-set_target_properties(wmilib PROPERTIES SUFFIX ".sys")
 add_importlibs(wmilib ntoskrnl)
 add_importlib_target(wmilib.spec)
 add_cd_file(TARGET wmilib DESTINATION reactos/system32/drivers FOR all)
 add_importlibs(wmilib ntoskrnl)
 add_importlib_target(wmilib.spec)
 add_cd_file(TARGET wmilib DESTINATION reactos/system32/drivers FOR all)
index cbbca9c..eac3dd1 100644 (file)
@@ -4,7 +4,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/mingw-w64)
 add_definitions(-D_CRTBLD)
 
 if(NOT MSVC)
 add_definitions(-D_CRTBLD)
 
 if(NOT MSVC)
-    add_definitions(-Wno-main)
+    add_compile_flags("-Wno-main")
 endif()
 
 list(APPEND MINGW_COMMON_SOURCE
 endif()
 
 list(APPEND MINGW_COMMON_SOURCE
index 65b092e..7d38008 100644 (file)
@@ -22,7 +22,7 @@ else()
 
     add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST)
     if(NOT MSVC)
 
     add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST)
     if(NOT MSVC)
-        add_compiler_flags(-Wpointer-arith -Wwrite-strings)
+        add_compile_flags("-Wpointer-arith -Wwrite-strings")
     endif()
     add_library(inflibhost ${GLOBAL_FILES} ${SOURCE})
     target_link_libraries(inflibhost unicode)
     endif()
     add_library(inflibhost ${GLOBAL_FILES} ${SOURCE})
     target_link_libraries(inflibhost unicode)
index 9099448..9bc5dd0 100644 (file)
@@ -2,7 +2,7 @@
 include_directories(include/internal/mingw-w64)
 
 if(NOT MSVC)
 include_directories(include/internal/mingw-w64)
 
 if(NOT MSVC)
-    add_compiler_flags(-Wno-main)
+    add_compile_flags("-Wno-main")
 endif()
 
 list(APPEND MSVCRTEX_SOURCE
 endif()
 
 list(APPEND MSVCRTEX_SOURCE