Author: tfaber Date: Sat Sep 3 18:59:14 2011 New Revision: 53558
URL: http://svn.reactos.org/svn/reactos?rev=53558&view=rev Log: [CMAKE] - 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)
Modified: trunk/reactos/CMakeLists.txt trunk/reactos/cmake/compilerflags.cmake trunk/reactos/dll/3rdparty/mesa32/CMakeLists.txt trunk/reactos/dll/ntdll/CMakeLists.txt trunk/reactos/dll/win32/browseui/CMakeLists.txt trunk/reactos/dll/win32/msvcrt/CMakeLists.txt trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt trunk/reactos/dll/win32/msxml3/CMakeLists.txt trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt trunk/reactos/drivers/wdm/audio/drm/drmk/CMakeLists.txt trunk/reactos/drivers/wmi/CMakeLists.txt trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt trunk/reactos/lib/newinflib/CMakeLists.txt trunk/reactos/lib/sdk/crt/msvcrtex.cmake
Modified: trunk/reactos/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=53558&am... ============================================================================== --- trunk/reactos/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -52,7 +52,7 @@ endif() add_definitions(/Dinline=__inline) else() - add_compiler_flags(-fshort-wchar) + add_compile_flags("-fshort-wchar") endif()
include_directories(include/host)
Modified: trunk/reactos/cmake/compilerflags.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/compilerflags.cmake?r... ============================================================================== --- trunk/reactos/cmake/compilerflags.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/compilerflags.cmake [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -24,33 +24,8 @@ 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 @@ -59,7 +34,7 @@ # 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)
Modified: trunk/reactos/dll/3rdparty/mesa32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/mesa32/CMakeLi... ============================================================================== --- trunk/reactos/dll/3rdparty/mesa32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/mesa32/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -1,6 +1,6 @@
if(NOT MSVC) - add_compiler_flags(-w) + add_compile_flags("-w") endif()
add_definitions(
Modified: trunk/reactos/dll/ntdll/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/CMakeLists.txt?re... ============================================================================== --- trunk/reactos/dll/ntdll/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -39,7 +39,7 @@ set_module_type(ntdll win32dll ENTRYPOINT 0)
if(MSVC) - add_linkerflag(ntdll /RELEASE) + add_target_link_flags(ntdll "/RELEASE") endif()
target_link_libraries(ntdll
Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/CMakeLis... ============================================================================== --- trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -7,7 +7,7 @@ -DROS_Headers)
if (MSVC) - add_compiler_flags(/EHa-) + add_compile_flags("/EHa-") endif()
remove_definitions(-D_WIN32_WINNT=0x502)
Modified: trunk/reactos/dll/win32/msvcrt/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/msvcrt/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -31,7 +31,7 @@
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)
Modified: trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt20/CMakeLis... ============================================================================== --- trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -28,7 +28,7 @@
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)
Modified: trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt40/CMakeLis... ============================================================================== --- trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -29,7 +29,7 @@
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)
Modified: trunk/reactos/dll/win32/msxml3/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/msxml3/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -11,7 +11,7 @@ -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)
Modified: trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/CMa... ============================================================================== --- trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -13,7 +13,7 @@ set_rc_compiler()
if(MSVC) - add_compiler_flags(/FItypeof.h) + add_compile_flags("/FItypeof.h") endif()
spec2def(windowscodecs.dll windowscodecs.spec)
Modified: trunk/reactos/drivers/wdm/audio/drm/drmk/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drm/drmk/... ============================================================================== --- trunk/reactos/drivers/wdm/audio/drm/drmk/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drm/drmk/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -10,18 +10,8 @@
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)
Modified: trunk/reactos/drivers/wmi/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wmi/CMakeLists.txt?... ============================================================================== --- trunk/reactos/drivers/wmi/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/wmi/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -8,19 +8,8 @@
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)
Modified: trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/CMakeLis... ============================================================================== --- trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -4,7 +4,7 @@ add_definitions(-D_CRTBLD)
if(NOT MSVC) - add_definitions(-Wno-main) + add_compile_flags("-Wno-main") endif()
list(APPEND MINGW_COMMON_SOURCE
Modified: trunk/reactos/lib/newinflib/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/CMakeLists.tx... ============================================================================== --- trunk/reactos/lib/newinflib/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/CMakeLists.txt [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -22,7 +22,7 @@
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)
Modified: trunk/reactos/lib/sdk/crt/msvcrtex.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/msvcrtex.cmake?... ============================================================================== --- trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] Sat Sep 3 18:59:14 2011 @@ -2,7 +2,7 @@ include_directories(include/internal/mingw-w64)
if(NOT MSVC) - add_compiler_flags(-Wno-main) + add_compile_flags("-Wno-main") endif()
list(APPEND MSVCRTEX_SOURCE