mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:35:43 +00:00
[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) svn path=/trunk/; revision=53558
This commit is contained in:
parent
c4bbdcbfdf
commit
427928c2a5
15 changed files with 17 additions and 63 deletions
|
@ -52,7 +52,7 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
endif()
|
endif()
|
||||||
add_definitions(/Dinline=__inline)
|
add_definitions(/Dinline=__inline)
|
||||||
else()
|
else()
|
||||||
add_compiler_flags(-fshort-wchar)
|
add_compile_flags("-fshort-wchar")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(include/host)
|
include_directories(include/host)
|
||||||
|
|
|
@ -24,33 +24,8 @@ function(add_target_property _module _propname)
|
||||||
set_property(TARGET ${_module} PROPERTY ${_propname} ${_newvalue})
|
set_property(TARGET ${_module} PROPERTY ${_propname} ${_newvalue})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#
|
# Wrapper functions for the important properties, using add_target_property
|
||||||
# For backwards compatibility. To be removed soon.
|
# where appropriate.
|
||||||
#
|
|
||||||
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.
|
|
||||||
# Note that the functions for string properties take a single string
|
# Note that the functions for string properties take a single string
|
||||||
# argument while those for list properties can take a variable number of
|
# argument while those for list properties can take a variable number of
|
||||||
# arguments, all of which will be added to the list
|
# arguments, all of which will be added to the list
|
||||||
|
@ -59,7 +34,7 @@ endfunction()
|
||||||
# add_compile_flags("-pedantic -O5")
|
# add_compile_flags("-pedantic -O5")
|
||||||
# add_target_link_flags(mymodule "-s --fatal-warnings")
|
# add_target_link_flags(mymodule "-s --fatal-warnings")
|
||||||
# add_target_compile_flags(mymodule "-pedantic -O5")
|
# 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)
|
# add_target_include_directories(mymodule include ../include)
|
||||||
function(add_compile_flags _flags)
|
function(add_compile_flags _flags)
|
||||||
if (${ARGC} GREATER 1)
|
if (${ARGC} GREATER 1)
|
||||||
|
|
2
reactos/dll/3rdparty/mesa32/CMakeLists.txt
vendored
2
reactos/dll/3rdparty/mesa32/CMakeLists.txt
vendored
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_compiler_flags(-w)
|
add_compile_flags("-w")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
|
|
|
@ -39,7 +39,7 @@ add_library(ntdll SHARED ${SOURCE})
|
||||||
set_module_type(ntdll win32dll ENTRYPOINT 0)
|
set_module_type(ntdll win32dll ENTRYPOINT 0)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_linkerflag(ntdll /RELEASE)
|
add_target_link_flags(ntdll "/RELEASE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(ntdll
|
target_link_libraries(ntdll
|
||||||
|
|
|
@ -7,7 +7,7 @@ add_definitions(
|
||||||
-DROS_Headers)
|
-DROS_Headers)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_compiler_flags(/EHa-)
|
add_compile_flags("/EHa-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||||
|
|
|
@ -31,7 +31,7 @@ target_link_libraries(msvcrt crt wine ${PSEH_LIB})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# export of deleting destructor "name"
|
# export of deleting destructor "name"
|
||||||
add_linkerflag(msvcrt "/ignore:4102")
|
add_target_link_flags(msvcrt "/ignore:4102")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_importlibs(msvcrt kernel32 ntdll)
|
add_importlibs(msvcrt kernel32 ntdll)
|
||||||
|
|
|
@ -28,7 +28,7 @@ target_link_libraries(msvcrt20 crt wine ${PSEH_LIB})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# export of deleting destructor "name"
|
# export of deleting destructor "name"
|
||||||
add_linkerflag(msvcrt20 "/ignore:4102")
|
add_target_link_flags(msvcrt20 "/ignore:4102")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_importlibs(msvcrt20 kernel32 ntdll)
|
add_importlibs(msvcrt20 kernel32 ntdll)
|
||||||
|
|
|
@ -29,7 +29,7 @@ target_link_libraries(msvcrt40 crt wine ${PSEH_LIB})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# export of deleting destructor "name"
|
# export of deleting destructor "name"
|
||||||
add_linkerflag(msvcrt40 "/ignore:4102")
|
add_target_link_flags(msvcrt40 "/ignore:4102")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_importlibs(msvcrt40 kernel32 ntdll)
|
add_importlibs(msvcrt40 kernel32 ntdll)
|
||||||
|
|
|
@ -11,7 +11,7 @@ add_definitions(
|
||||||
-DLIBXML_STATIC)
|
-DLIBXML_STATIC)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compiler_flags(/FIwine/typeof.h /FImsvc.h)
|
add_compile_flags("/FIwine/typeof.h /FImsvc.h")
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||||
|
|
|
@ -13,7 +13,7 @@ include_directories(
|
||||||
set_rc_compiler()
|
set_rc_compiler()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compiler_flags(/FItypeof.h)
|
add_compile_flags("/FItypeof.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
spec2def(windowscodecs.dll windowscodecs.spec)
|
spec2def(windowscodecs.dll windowscodecs.spec)
|
||||||
|
|
|
@ -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 ENTRYPOINT 0)
|
||||||
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_entrypoint(drmk 0)
|
|
||||||
add_importlibs(drmk ntoskrnl)
|
add_importlibs(drmk ntoskrnl)
|
||||||
add_importlib_target(drmk.spec)
|
add_importlib_target(drmk.spec)
|
||||||
add_cd_file(TARGET drmk DESTINATION reactos/system32/drivers FOR all)
|
add_cd_file(TARGET drmk DESTINATION reactos/system32/drivers FOR all)
|
||||||
|
|
|
@ -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 ENTRYPOINT 0)
|
||||||
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_entrypoint(wmilib 0)
|
|
||||||
set_target_properties(wmilib PROPERTIES SUFFIX ".sys")
|
|
||||||
add_importlibs(wmilib ntoskrnl)
|
add_importlibs(wmilib ntoskrnl)
|
||||||
add_importlib_target(wmilib.spec)
|
add_importlib_target(wmilib.spec)
|
||||||
add_cd_file(TARGET wmilib DESTINATION reactos/system32/drivers FOR all)
|
add_cd_file(TARGET wmilib DESTINATION reactos/system32/drivers FOR all)
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/CMakeLists.txt
vendored
2
reactos/lib/3rdparty/mingw/CMakeLists.txt
vendored
|
@ -4,7 +4,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/mingw-w64)
|
||||||
add_definitions(-D_CRTBLD)
|
add_definitions(-D_CRTBLD)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_definitions(-Wno-main)
|
add_compile_flags("-Wno-main")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND MINGW_COMMON_SOURCE
|
list(APPEND MINGW_COMMON_SOURCE
|
||||||
|
|
|
@ -22,7 +22,7 @@ else()
|
||||||
|
|
||||||
add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST)
|
add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_compiler_flags(-Wpointer-arith -Wwrite-strings)
|
add_compile_flags("-Wpointer-arith -Wwrite-strings")
|
||||||
endif()
|
endif()
|
||||||
add_library(inflibhost ${GLOBAL_FILES} ${SOURCE})
|
add_library(inflibhost ${GLOBAL_FILES} ${SOURCE})
|
||||||
target_link_libraries(inflibhost unicode)
|
target_link_libraries(inflibhost unicode)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
include_directories(include/internal/mingw-w64)
|
include_directories(include/internal/mingw-w64)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_compiler_flags(-Wno-main)
|
add_compile_flags("-Wno-main")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND MSVCRTEX_SOURCE
|
list(APPEND MSVCRTEX_SOURCE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue