[CMAKE] Replace custom functions to built-in ones

add_target_compile_definitions -> target_compile_definitions
add_target_compile_flags -> target_compile_options
add_target_include_directories -> target_include_directories
This commit is contained in:
Victor Perevertkin 2020-04-16 15:59:38 +03:00
parent 480f729f6d
commit 7e069ccdb2
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
93 changed files with 163 additions and 180 deletions

View file

@ -56,7 +56,7 @@ add_executable(nfsd ${SOURCE} nfsd.rc)
if(MSVC AND (NOT USE_CLANG_CL))
else()
# FIXME: Tons of warnings.
add_target_compile_flags(nfsd "-w")
target_compile_options(nfsd PRIVATE "-w")
endif()
set_module_type(nfsd win32cui)

View file

@ -17,7 +17,7 @@ include_directories(${REACTOS_BINARY_DIR}/sdk/include/reactos/wine)
add_executable(rpcss ${SOURCE} rpcss.rc)
if(USE_CLANG_CL)
add_target_compile_flags(rpcss "-Wno-cast-calling-convention")
target_compile_options(rpcss PRIVATE "-Wno-cast-calling-convention")
endif()
target_link_libraries(rpcss ${PSEH_LIB} wine)

View file

@ -11,7 +11,7 @@ list(APPEND SOURCE
add_executable(wlansvc ${SOURCE} wlansvc.rc)
if(USE_CLANG_CL)
add_target_compile_flags(wlansvc "-Wno-cast-calling-convention")
target_compile_options(wlansvc PRIVATE "-Wno-cast-calling-convention")
endif()
if(NOT MSVC)

View file

@ -31,7 +31,7 @@ list(APPEND SOURCE
add_executable(usetup ${SOURCE} usetup.rc)
if(USE_CLANG_CL)
add_target_compile_flags(usetup "-Wno-invalid-source-encoding")
target_compile_options(usetup PRIVATE "-Wno-invalid-source-encoding")
endif()
add_pch(usetup usetup.h SOURCE)

View file

@ -222,7 +222,7 @@ add_library(freeldr_common
if(USE_CLANG_CL)
# We need to reduce the binary size
add_target_compile_flags(freeldr_common "/Os")
target_compile_options(freeldr_common PRIVATE "/Os")
endif()
if(NOT MSVC AND ARCH STREQUAL "i386" AND SARCH STREQUAL "xbox")
# Prevent a warning when doing a memcmp with address 0

View file

@ -70,5 +70,5 @@ add_pch(libtiff precomp.h SOURCE)
add_cd_file(TARGET libtiff DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(libtiff "-Wno-unused-but-set-variable")
target_compile_options(libtiff PRIVATE "-Wno-unused-but-set-variable")
endif()

View file

@ -103,10 +103,10 @@ add_library(libtirpc MODULE
if(MSVC AND (NOT USE_CLANG_CL))
replace_compile_flags("/we4101" " ")
add_target_compile_flags(libtirpc "/wd4101 /wd4133 /wd4473 /wd4477")
target_compile_options(libtirpc PRIVATE /wd4101 /wd4133 /wd4473 /wd4477)
else()
# FIXME: Tons of warnings.
add_target_compile_flags(libtirpc "-w")
target_compile_options(libtirpc PRIVATE "-w")
endif()
set_module_type(libtirpc win32dll)

View file

@ -51,5 +51,5 @@ add_pch(libxslt precomp.h SOURCE)
add_cd_file(TARGET libxslt DESTINATION reactos/system32 FOR all)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(libxslt "-Wno-pointer-sign -Wno-unused-function")
target_compile_options(libxslt PRIVATE -Wno-pointer-sign -Wno-unused-function)
endif()

View file

@ -94,7 +94,7 @@ add_definitions(-DMINGW_HAS_SECURE_API -DCRTDLL)
add_cd_file(TARGET mbedtls DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(mbedtls "-Wno-pointer-sign -Wno-unused-function")
target_compile_options(mbedtls PRIVATE -Wno-pointer-sign -Wno-unused-function)
elseif(USE_CLANG_CL)
add_target_compile_flags(mbedtls "-Wno-tautological-constant-compare")
target_compile_options(mbedtls PRIVATE -Wno-tautological-constant-compare)
endif()

View file

@ -25,9 +25,9 @@ function (add_apiset apiset_name baseaddress)
set_module_type(${apiset_name} win32dll ENTRYPOINT 0 UNICODE IMAGEBASE ${baseaddress})
if(NOT MSVC)
add_target_compile_flags(${apiset_name} "-fno-builtin")
target_compile_options(${apiset_name} PRIVATE -fno-builtin)
else()
add_target_compile_flags(${apiset_name} "/wd4026 /wd4273")
target_compile_options(${apiset_name} PRIVATE /wd4026 /wd4273)
endif()
add_importlibs(${apiset_name} ${ARGN} ntdll)

View file

@ -25,9 +25,9 @@ function (add_apiset apiset_name baseaddress)
set_module_type(${apiset_name} win32dll ENTRYPOINT 0 UNICODE IMAGEBASE ${baseaddress})
if(NOT MSVC)
add_target_compile_flags(${apiset_name} "-fno-builtin")
target_compile_options(${apiset_name} PRIVATE -fno-builtin)
else()
add_target_compile_flags(${apiset_name} "/wd4026 /wd4273")
target_compile_options(${apiset_name} PRIVATE /wd4026 /wd4273)
endif()
add_importlibs(${apiset_name} ${ARGN} ntdll)

View file

@ -26,7 +26,7 @@ list(APPEND SOURCE
if(MSVC)
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
#add_target_compile_flags(ddraw "/FIwine/typeof.h")
#target_compile_options(ddraw PRIVATE "/FIwine/typeof.h")
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "/FIwine/typeof.h")
endif()

View file

@ -11,7 +11,7 @@ add_library(idndl MODULE
set_entrypoint(idndl 0)
if(NOT MSVC)
add_target_compile_flags(idndl "-fno-exceptions -fno-rtti")
target_compile_options(idndl PRIVATE -fno-exceptions -fno-rtti)
endif()
add_importlibs(idndl kernel32)

View file

@ -120,12 +120,12 @@ add_library(glu32 MODULE
set_module_type(glu32 win32dll)
if(NOT MSVC)
add_target_compile_flags(glu32 "-Wno-write-strings -Wno-unused-but-set-variable")
target_compile_options(glu32 PRIVATE -Wno-write-strings -Wno-unused-but-set-variable)
# Prevent a warning when comparing 'this' against 0
set_source_files_properties(src/libnurbs/internals/arc.cc PROPERTIES COMPILE_FLAGS "-Wno-nonnull-compare")
elseif(USE_CLANG_CL)
add_target_compile_flags(glu32 "-Wno-self-assign -Wno-unused-function -Wno-microsoft-include")
add_target_compile_flags(glu32 "-Wno-deprecated-register -Wno-tautological-undefined-compare")
target_compile_options(glu32 PRIVATE -Wno-self-assign -Wno-unused-function -Wno-microsoft-include)
target_compile_options(glu32 PRIVATE -Wno-deprecated-register -Wno-tautological-undefined-compare)
endif()
add_importlibs(glu32 opengl32 gdi32 msvcrt kernel32 ntdll)

View file

@ -53,7 +53,7 @@ add_pch(browseui precomp.h SOURCE)
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(browseui "-Wno-unused-but-set-variable")
target_compile_options(browseui PRIVATE "-Wno-unused-but-set-variable")
# Binutils linker bug
if(LTCG)
add_target_link_flags(browseui "-Wl,--allow-multiple-definition")

View file

@ -19,7 +19,7 @@ list(APPEND SOURCE
add_library(shellbars ${SOURCE})
if(NOT MSVC)
add_target_compile_flags(shellbars "-Wno-unused-but-set-variable")
target_compile_options(shellbars PRIVATE "-Wno-unused-but-set-variable")
endif()
add_pch(shellbars shellbars.h SOURCE)

View file

@ -16,7 +16,7 @@ list(APPEND SOURCE
add_library(shellfind ${SOURCE})
if(NOT MSVC)
add_target_compile_flags(shellfind "-Wno-unused-but-set-variable")
target_compile_options(shellfind PRIVATE "-Wno-unused-but-set-variable")
endif()
add_pch(shellfind shellfind.h SOURCE)

View file

@ -16,6 +16,6 @@ list(APPEND SOURCE
add_library(fltlib MODULE ${SOURCE} rsrc.rc)
set_module_type(fltlib win32dll)
target_link_libraries(fltlib wine)
add_target_compile_definitions(fltlib NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(fltlib PRIVATE NTDDI_VERSION=NTDDI_WS03SP1)
add_importlibs(fltlib msvcrt kernel32 ntdll)
add_cd_file(TARGET fltlib DESTINATION reactos/system32 FOR all)

View file

@ -14,5 +14,5 @@ add_importlibs(mciseq winmm user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET mciseq DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(mciseq "-Wno-overflow")
target_compile_options(mciseq PRIVATE "-Wno-overflow")
endif()

View file

@ -17,5 +17,5 @@ add_importlibs(mciwave user32 winmm msvcrt kernel32 ntdll)
add_cd_file(TARGET mciwave DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(mciwave "-Wno-overflow")
target_compile_options(mciwave PRIVATE "-Wno-overflow")
endif()

View file

@ -33,7 +33,7 @@ add_pch(winmm winemm.h SOURCE)
add_cd_file(TARGET winmm DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
add_target_compile_flags(winmm "-Wno-unused-but-set-variable")
target_compile_options(winmm PRIVATE "-Wno-unused-but-set-variable")
endif()
add_subdirectory(midimap)

View file

@ -13,7 +13,7 @@ list(APPEND SOURCE
add_library(fbtusb MODULE ${SOURCE} fbtusb.rc)
if(NOT MSVC)
add_target_compile_flags(fbtusb "-Wno-unused-but-set-variable")
target_compile_options(fbtusb PRIVATE "-Wno-unused-but-set-variable")
endif()
set_module_type(fbtusb kernelmodedriver)

View file

@ -96,16 +96,16 @@ if(MSVC AND (NOT USE_CLANG_CL))
# Disable warnings: "unreferenced local variable", "initialized, but not used variable", "benign include"
replace_compile_flags("/we4101" " ")
replace_compile_flags("/we4189" " ")
add_target_compile_flags(ext2fs "/wd4189 /wd4142 /wd4101")
target_compile_options(ext2fs PRIVATE /wd4189 /wd4142 /wd4101)
else()
add_target_compile_flags(ext2fs "-Wno-pointer-sign -Wno-unused-function")
add_target_compile_flags(ext2fs "-Wno-unused-variable -Wno-missing-braces")
target_compile_options(ext2fs PRIVATE -Wno-pointer-sign -Wno-unused-function)
target_compile_options(ext2fs PRIVATE -Wno-unused-variable -Wno-missing-braces)
if(USE_CLANG_CL)
add_target_compile_flags(ext2fs "-Wno-unused-value -Wno-parentheses-equality")
add_target_compile_flags(ext2fs "-Wno-incompatible-pointer-types-discards-qualifiers")
add_target_compile_flags(ext2fs "-Wno-#pragma-messages -Wno-cast-calling-convention")
target_compile_options(ext2fs PRIVATE -Wno-unused-value -Wno-parentheses-equality)
target_compile_options(ext2fs PRIVATE -Wno-incompatible-pointer-types-discards-qualifiers)
target_compile_options(ext2fs PRIVATE "-Wno-#pragma-messages;-Wno-cast-calling-convention")
else()
add_target_compile_flags(ext2fs "-Wno-unused-but-set-variable")
target_compile_options(ext2fs PRIVATE -Wno-unused-but-set-variable)
endif()
endif()

View file

@ -31,12 +31,12 @@ list(APPEND SOURCE
add_library(ffs MODULE ${SOURCE} src/ffsdrv.rc)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(ffs "-Wno-pointer-sign -Wno-unused-function")
add_target_compile_flags(ffs "-Wno-unused-variable -Wno-missing-braces")
target_compile_options(ffs PRIVATE -Wno-pointer-sign -Wno-unused-function)
target_compile_options(ffs PRIVATE -Wno-unused-variable -Wno-missing-braces)
if(USE_CLANG_CL)
add_target_compile_flags(ffs "-Wno-empty-body")
target_compile_options(ffs PRIVATE -Wno-empty-body)
else()
add_target_compile_flags(ffs "-Wno-unused-but-set-variable")
target_compile_options(ffs PRIVATE -Wno-unused-but-set-variable)
endif()
endif()

View file

@ -15,9 +15,9 @@ target_link_libraries(nfs41_driver ntoskrnl_vista rdbsslib rxce copysup memcmp $
add_importlibs(nfs41_driver ntoskrnl hal)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(nfs41_driver "-Wno-switch")
target_compile_options(nfs41_driver PRIVATE "-Wno-switch")
if(USE_CLANG_CL)
add_target_compile_flags(nfs41_driver "-Wno-unused-value")
target_compile_options(nfs41_driver PRIVATE "-Wno-unused-value")
endif()
endif()

View file

@ -79,16 +79,17 @@ list(APPEND SOURCE
add_library(reiserfs MODULE ${SOURCE} src/rfsd.rc)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(reiserfs "-Wno-missing-braces -Wno-pointer-sign")
add_target_compile_flags(reiserfs "-Wno-unused-function -Wno-unused-variable")
target_compile_options(reiserfs PRIVATE -Wno-missing-braces -Wno-pointer-sign)
target_compile_options(reiserfs PRIVATE -Wno-unused-function -Wno-unused-variable)
if(NOT USE_CLANG_CL)
add_target_compile_flags(reiserfs "-Wno-unused-but-set-variable -D__GCC__")
target_compile_options(reiserfs PRIVATE -Wno-unused-but-set-variable)
target_compile_definitions(reiserfs PRIVATE __GCC__)
endif()
else()
#disable warnings: "unreferenced local variable", "initialized, but not used variable", "benign include"
replace_compile_flags("/we4101" " ")
replace_compile_flags("/we4189" " ")
add_target_compile_flags(reiserfs "/wd4189 /wd4142 /wd4101")
target_compile_options(reiserfs PRIVATE /wd4189 /wd4142 /wd4101)
endif()
target_link_libraries(reiserfs memcmp ${PSEH_LIB})

View file

@ -45,15 +45,15 @@ add_library(udfs MODULE ${SOURCE} udffs.rc)
if(MSVC)
# FIXME: Make sure we marked all what needs to be marked with stdcall before removing this.
add_target_compile_flags(udfs "/Gz")
target_compile_options(udfs PRIVATE "/Gz")
if(USE_CLANG_CL)
add_target_compile_flags(udfs "-Wno-extern-c-compat -Wno-unused-value")
add_target_compile_flags(udfs "-Wno-tautological-constant-out-of-range-compare")
add_target_compile_flags(udfs "-Wno-tautological-unsigned-zero-compare -Wno-self-assign")
add_target_compile_flags(udfs "-Wno-sometimes-uninitialized -Wno-parentheses-equality")
target_compile_options(udfs PRIVATE -Wno-extern-c-compat -Wno-unused-value)
target_compile_options(udfs PRIVATE -Wno-tautological-constant-out-of-range-compare)
target_compile_options(udfs PRIVATE -Wno-tautological-unsigned-zero-compare -Wno-self-assign)
target_compile_options(udfs PRIVATE -Wno-sometimes-uninitialized -Wno-parentheses-equality)
endif()
else()
add_target_compile_flags(udfs "-Wno-unused-but-set-variable")
target_compile_options(udfs PRIVATE "-Wno-unused-but-set-variable")
endif()
set_module_type(udfs kernelmodedriver)

View file

@ -26,6 +26,6 @@ add_library(fltmgr MODULE
set_module_type(fltmgr kernelmodedriver)
target_link_libraries(fltmgr ${PSEH_LIB})
add_importlibs(fltmgr ntoskrnl hal)
add_target_compile_definitions(fltmgr NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(fltmgr PRIVATE NTDDI_VERSION=NTDDI_WS03SP1)
add_pch(fltmgr fltmgr.h SOURCE)
add_cd_file(TARGET fltmgr DESTINATION reactos/system32/drivers NO_CAB FOR all)

View file

@ -13,9 +13,9 @@ add_library(cdrom_new MODULE ${SOURCE})
target_link_libraries(cdrom_new libcntpr wdmguid)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(cdrom_new "-Wno-format -Wno-unused-variable -Wno-pointer-sign")
target_compile_options(cdrom_new PRIVATE -Wno-format -Wno-unused-variable -Wno-pointer-sign)
if(USE_CLANG_CL)
add_target_compile_flags(cdrom_new "-Wno-enum-conversion -Wno-tautological-constant-compare")
target_compile_options(cdrom_new PRIVATE -Wno-enum-conversion -Wno-tautological-constant-compare)
endif()
endif()

View file

@ -15,7 +15,7 @@ add_library(disk_new MODULE ${SOURCE} disk.rc)
target_link_libraries(disk_new libcntpr wdmguid)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(disk_new "-Wno-format -Wno-pointer-sign")
target_compile_options(disk_new PRIVATE -Wno-format -Wno-pointer-sign)
endif()
set_module_type(disk_new kernelmodedriver)

View file

@ -23,11 +23,11 @@ list(APPEND SOURCE
add_library(uniata MODULE ${SOURCE} idedma.rc)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(uniata "-Wno-narrowing")
target_compile_options(uniata PRIVATE "-Wno-narrowing")
if(USE_CLANG_CL)
add_target_compile_flags(uniata "-Wno-unused-const-variable")
target_compile_options(uniata PRIVATE "-Wno-unused-const-variable")
else()
add_target_compile_flags(uniata "-Wno-unused-but-set-variable")
target_compile_options(uniata PRIVATE "-Wno-unused-but-set-variable")
endif()
endif()

View file

@ -56,7 +56,7 @@ add_library(portcls MODULE
${CMAKE_CURRENT_BINARY_DIR}/portcls.def)
if(USE_CLANG_CL)
add_target_compile_flags(portcls "-Wno-missing-braces")
target_compile_options(portcls PRIVATE "-Wno-missing-braces")
endif()
target_link_libraries(portcls libcntpr ${PSEH_LIB})

View file

@ -25,7 +25,7 @@ set_module_type(cmipci wdmdriver UNICODE)
add_importlibs(cmipci portcls hal ntoskrnl)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(cmipci "-Wno-write-strings -Wno-switch")
target_compile_options(cmipci PRIVATE -Wno-write-strings -Wno-switch)
endif()
add_pch(cmipci precomp.h SOURCE)

View file

@ -27,6 +27,6 @@ list(APPEND MINI_HAL_SOURCE
add_asm_files(mini_hal_asm ../generic/systimer.S)
add_library(mini_hal ${MINI_HAL_SOURCE} ${mini_hal_asm})
add_target_compile_definitions(mini_hal _BLDR_ _MINIHAL_)
target_compile_definitions(mini_hal PRIVATE _BLDR_ _MINIHAL_)
add_dependencies(mini_hal psdk bugcodes asm)
add_pch(mini_hal ../include/hal.h MINI_HAL_SOURCE)

View file

@ -39,7 +39,7 @@ list(APPEND HAL_XBOX_SOURCE
add_asm_files(lib_hal_xbox_asm ${HAL_XBOX_ASM_SOURCE})
add_object_library(lib_hal_xbox ${HAL_XBOX_SOURCE} ${lib_hal_xbox_asm})
if(NOT SARCH STREQUAL "xbox")
add_target_compile_definitions(lib_hal_xbox SARCH_XBOX)
target_compile_definitions(lib_hal_xbox PRIVATE SARCH_XBOX)
endif()
add_dependencies(lib_hal_xbox bugcodes xdk asm)
#add_pch(lib_hal_xbox xbox/halxbox.h)

View file

@ -5,6 +5,6 @@ set_module_type(symdump win32cui)
target_link_libraries(symdump wine)
add_importlibs(symdump dbghelp shlwapi msvcrt kernel32 ntdll)
if(NOT MSVC)
add_target_compile_flags(symdump "-Wno-unused-but-set-variable")
target_compile_options(symdump PRIVATE "-Wno-unused-but-set-variable")
endif()
add_cd_file(TARGET symdump DESTINATION reactos/system32 FOR all)

View file

@ -17,7 +17,7 @@ add_importlibs(frag user32 advapi32 shell32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET frag DESTINATION reactos/system32 FOR all)
add_executable(unfrag ${UNFRAG_SOURCE})
add_target_compile_definitions(unfrag "_CUI_")
target_compile_definitions(unfrag PRIVATE "_CUI_")
set_module_type(unfrag win32cui UNICODE)
add_importlibs(unfrag advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET unfrag DESTINATION reactos/system32 FOR all)

View file

@ -70,10 +70,9 @@ list(APPEND SOURCE
add_executable(ncftp ${SOURCE} ncftp.rc)
set_module_type(ncftp win32cui)
target_compile_definitions(ncftp PRIVATE HAVE_UTIME_H HAVE_UNISTD_H)
if(NOT MSVC)
add_target_compile_flags(ncftp "-DHAVE_UTIME_H -DHAVE_UNISTD_H -Wno-unused-but-set-variable")
else()
add_target_compile_flags(ncftp "-DHAVE_UTIME_H -DHAVE_UNISTD_H")
target_compile_options(ncftp PRIVATE -Wno-unused-but-set-variable)
endif()
add_importlibs(ncftp advapi32 user32 ws2_32 msvcrt kernel32)
add_cd_file(TARGET ncftp DESTINATION reactos/system32 FOR all)

View file

@ -2,7 +2,7 @@
add_executable(logevent logevent.c logevent.rc)
set_module_type(logevent win32cui)
if(NOT MSVC)
add_target_compile_flags(logevent "-Wno-unused-but-set-variable")
target_compile_options(logevent PRIVATE "-Wno-unused-but-set-variable")
endif()
add_importlibs(logevent advapi32 msvcrt kernel32)
add_cd_file(TARGET logevent DESTINATION reactos/system32 FOR all)

View file

@ -2,7 +2,7 @@
add_executable(pedump pedump.c pedump.rc)
set_module_type(pedump win32cui)
if(NOT MSVC)
add_target_compile_flags(pedump "-Wno-unused-but-set-variable")
target_compile_options(pedump PRIVATE "-Wno-unused-but-set-variable")
endif()
add_importlibs(pedump msvcrt kernel32 ntdll)
add_cd_file(TARGET pedump DESTINATION reactos/system32 FOR all)

View file

@ -12,7 +12,7 @@ list(APPEND SOURCE
add_executable(rosperf ${SOURCE} rosperf.rc)
set_module_type(rosperf win32cui UNICODE)
if(NOT MSVC)
add_target_compile_flags(rosperf "-Wno-unused-but-set-variable")
target_compile_options(rosperf PRIVATE "-Wno-unused-but-set-variable")
endif()
add_importlibs(rosperf version msimg32 gdi32 shell32 advapi32 user32 ntdll msvcrt kernel32)
add_cd_file(TARGET rosperf DESTINATION reactos/system32 FOR all)

View file

@ -9,5 +9,5 @@ add_cd_file(TARGET winefile DESTINATION reactos/system32 FOR all)
#if(NOT MSVC)
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
# add_target_compile_flags(winefile "-Wno-format")
# target_compile_options(winefile PRIVATE "-Wno-format")
#endif()

View file

@ -10,7 +10,7 @@ list(APPEND SOURCE
add_executable(template_dialog ${SOURCE} dialog.rc)
set_module_type(template_dialog win32cui)
if(NOT MSVC)
add_target_compile_flags(template_dialog "-Wno-unused-but-set-variable")
target_compile_options(template_dialog PRIVATE "-Wno-unused-but-set-variable")
endif()
add_importlibs(template_dialog user32 gdi32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET template_dialog DESTINATION reactos/system32 FOR all)

View file

@ -553,7 +553,7 @@ endif()
add_executable(crtdll_crt_apitest testlist.c ${SOURCE_CRTDLL})
add_target_compile_definitions(crtdll_crt_apitest TEST_CRTDLL)
target_compile_definitions(crtdll_crt_apitest PRIVATE TEST_CRTDLL)
target_link_libraries(crtdll_crt_apitest wine ${PSEH_LIB})
set_module_type(crtdll_crt_apitest win32cui)
add_importlibs(crtdll_crt_apitest crtdll msvcrt kernel32 ntdll)

View file

@ -1375,7 +1375,7 @@ endif()
# Startup code doesn't go together well with the static CRT... too much __imp_
#add_executable(static_crt_apitest testlist.c ${SOURCE_MSVCRT})
#add_target_compile_definitions(static_crt_apitest TEST_STATIC_CRT)
#target_compile_definitions(static_crt_apitest PRIVATE TEST_STATIC_CRT)
#target_link_libraries(static_crt_apitest ${PSEH_LIB} crt wine)
#set_module_type(static_crt_apitest win32cui)
#add_importlibs(static_crt_apitest kernel32 ntdll)
@ -1391,7 +1391,7 @@ endif()
#add_rostests_file(TARGET static_crt_dll_startup)
add_executable(msvcrt_crt_apitest testlist.c ${SOURCE_MSVCRT})
add_target_compile_definitions(msvcrt_crt_apitest TEST_MSVCRT)
target_compile_definitions(msvcrt_crt_apitest PRIVATE TEST_MSVCRT)
target_link_libraries(msvcrt_crt_apitest wine ${PSEH_LIB})
set_module_type(msvcrt_crt_apitest win32cui)
add_importlibs(msvcrt_crt_apitest msvcrt kernel32 ntdll)

View file

@ -152,7 +152,7 @@ elseif(ARCH STREQUAL "amd64")
endif()
add_executable(ntdll_crt_apitest testlist.c ${SOURCE_NTDLL})
add_target_compile_definitions(ntdll_crt_apitest TEST_NTDLL)
target_compile_definitions(ntdll_crt_apitest PRIVATE TEST_NTDLL)
target_link_libraries(ntdll_crt_apitest wine ${PSEH_LIB})
set_module_type(ntdll_crt_apitest win32cui)
add_importlibs(ntdll_crt_apitest ntdll msvcrt kernel32)

View file

@ -106,7 +106,7 @@ set_module_type(kmtest_drv kernelmodedriver)
target_link_libraries(kmtest_drv kmtest_printf chkstk memcmp ntoskrnl_vista ${PSEH_LIB})
add_importlibs(kmtest_drv ntoskrnl hal)
add_dependencies(kmtest_drv bugcodes xdk)
add_target_compile_definitions(kmtest_drv KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(kmtest_drv PRIVATE KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
#add_pch(kmtest_drv include/kmt_test.h)
add_rostests_file(TARGET kmtest_drv)
@ -115,8 +115,8 @@ add_library(kmtest_printf
${REACTOS_SOURCE_DIR}/sdk/lib/crt/string/strnlen.c
${REACTOS_SOURCE_DIR}/sdk/lib/crt/string/wcsnlen.c
${REACTOS_SOURCE_DIR}/sdk/lib/crt/printf/streamout.c)
add_target_compile_definitions(kmtest_printf _LIBCNT_ _USER32_WSPRINTF wctomb=KmtWcToMb)
add_target_include_directories(kmtest_printf ${REACTOS_SOURCE_DIR}/sdk/lib/crt/include)
target_compile_definitions(kmtest_printf PRIVATE _LIBCNT_ _USER32_WSPRINTF wctomb=KmtWcToMb)
target_include_directories(kmtest_printf PRIVATE ${REACTOS_SOURCE_DIR}/sdk/lib/crt/include)
#
# kmtest.exe loader application
@ -159,7 +159,7 @@ add_executable(kmtest ${KMTEST_SOURCE})
set_module_type(kmtest win32cui)
target_link_libraries(kmtest ${PSEH_LIB})
add_importlibs(kmtest fltlib advapi32 ws2_32 msvcrt kernel32 ntdll)
add_target_compile_definitions(kmtest KMT_USER_MODE NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(kmtest PRIVATE KMT_USER_MODE NTDDI_VERSION=NTDDI_WS03SP1)
#add_pch(kmtest include/kmt_test.h)
set_target_properties(kmtest PROPERTIES OUTPUT_NAME "kmtest_")
add_rostests_file(TARGET kmtest)

View file

@ -9,6 +9,6 @@ add_library(example_drv MODULE ${EXAMPLE_DRV_SOURCE})
set_module_type(example_drv kernelmodedriver)
target_link_libraries(example_drv kmtest_printf ${PSEH_LIB})
add_importlibs(example_drv ntoskrnl hal)
add_target_compile_definitions(example_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(example_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(example_drv ../include/kmt_test.h)
add_rostests_file(TARGET example_drv)

View file

@ -9,6 +9,6 @@ add_library(fltmgr_create MODULE ${FLTMGR_TEST_DRV_SOURCE})
set_module_type(fltmgr_create kernelmodedriver)
target_link_libraries(fltmgr_create kmtest_printf ${PSEH_LIB})
add_importlibs(fltmgr_create fltmgr ntoskrnl hal)
add_target_compile_definitions(fltmgr_create KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(fltmgr_create PRIVATE KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
#add_pch(example_drv ../include/kmt_test.h)
add_rostests_file(TARGET fltmgr_create)

View file

@ -9,6 +9,6 @@ add_library(FltMgrLoad_drv MODULE ${FLTMGR_TEST_DRV_SOURCE})
set_module_type(FltMgrLoad_drv kernelmodedriver)
target_link_libraries(FltMgrLoad_drv kmtest_printf ${PSEH_LIB})
add_importlibs(FltMgrLoad_drv fltmgr ntoskrnl hal)
add_target_compile_definitions(FltMgrLoad_drv KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(FltMgrLoad_drv PRIVATE KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
#add_pch(example_drv ../include/kmt_test.h)
add_rostests_file(TARGET FltMgrLoad_drv)

View file

@ -10,6 +10,6 @@ add_library(fltmgrreg_drv MODULE ${FLTMGR_TEST_DRV_SOURCE})
set_module_type(fltmgrreg_drv kernelmodedriver)
target_link_libraries(fltmgrreg_drv kmtest_printf ${PSEH_LIB})
add_importlibs(fltmgrreg_drv fltmgr ntoskrnl hal)
add_target_compile_definitions(fltmgrreg_drv KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
target_compile_definitions(fltmgrreg_drv PRIVATE KMT_STANDALONE_DRIVER KMT_FILTER_DRIVER NTDDI_VERSION=NTDDI_WS03SP1)
#add_pch(example_drv ../include/kmt_test.h)
add_rostests_file(TARGET fltmgrreg_drv)

View file

@ -13,6 +13,6 @@ add_library(hidp_drv MODULE ${HIDP_DRV_SOURCE})
set_module_type(hidp_drv kernelmodedriver)
target_link_libraries(hidp_drv kmtest_printf ${PSEH_LIB})
add_importlibs(hidp_drv hidparse ntoskrnl hal)
add_target_compile_definitions(hidp_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(hidp_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(hidp_drv ../include/kmt_test.h)
add_rostests_file(TARGET hidp_drv)

View file

@ -9,6 +9,6 @@ add_library(kernel32_drv MODULE ${KERNEL32_DRV_SOURCE})
set_module_type(kernel32_drv kernelmodedriver)
target_link_libraries(kernel32_drv kmtest_printf ${PSEH_LIB})
add_importlibs(kernel32_drv ntoskrnl hal)
add_target_compile_definitions(kernel32_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(kernel32_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(kernel32_drv ../include/kmt_test.h)
add_rostests_file(TARGET kernel32_drv)

View file

@ -12,7 +12,7 @@ add_library(cccopyread_drv MODULE ${CCCOPYREAD_DRV_SOURCE})
set_module_type(cccopyread_drv kernelmodedriver)
target_link_libraries(cccopyread_drv kmtest_printf ${PSEH_LIB})
add_importlibs(cccopyread_drv ntoskrnl hal)
add_target_compile_definitions(cccopyread_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(cccopyread_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(cccopyread_drv ../include/kmt_test.h)
add_rostests_file(TARGET cccopyread_drv)
@ -27,7 +27,7 @@ add_library(cccopywrite_drv MODULE ${CCCOPYWRITE_DRV_SOURCE})
set_module_type(cccopywrite_drv kernelmodedriver)
target_link_libraries(cccopywrite_drv kmtest_printf ${PSEH_LIB})
add_importlibs(cccopywrite_drv ntoskrnl hal)
add_target_compile_definitions(cccopywrite_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(cccopywrite_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(cccopyread_drv ../include/kmt_test.h)
add_rostests_file(TARGET cccopywrite_drv)
@ -42,7 +42,7 @@ add_library(ccmapdata_drv MODULE ${CCMAPDATA_DRV_SOURCE})
set_module_type(ccmapdata_drv kernelmodedriver)
target_link_libraries(ccmapdata_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ccmapdata_drv ntoskrnl hal)
add_target_compile_definitions(ccmapdata_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ccmapdata_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ccmapdata_drv ../include/kmt_test.h)
add_rostests_file(TARGET ccmapdata_drv)
@ -57,7 +57,7 @@ add_library(ccpinmappeddata_drv MODULE ${CCPINMAPPEDDATA_DRV_SOURCE})
set_module_type(ccpinmappeddata_drv kernelmodedriver)
target_link_libraries(ccpinmappeddata_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ccpinmappeddata_drv ntoskrnl hal)
add_target_compile_definitions(ccpinmappeddata_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ccpinmappeddata_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ccpinmappeddata_drv ../include/kmt_test.h)
add_rostests_file(TARGET ccpinmappeddata_drv)
@ -72,7 +72,7 @@ add_library(ccpinread_drv MODULE ${CCPINREAD_DRV_SOURCE})
set_module_type(ccpinread_drv kernelmodedriver)
target_link_libraries(ccpinread_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ccpinread_drv ntoskrnl hal)
add_target_compile_definitions(ccpinread_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ccpinread_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ccmapdata_drv ../include/kmt_test.h)
add_rostests_file(TARGET ccpinread_drv)
@ -87,6 +87,6 @@ add_library(ccsetfilesizes_drv MODULE ${CCSETFILESIZES_DRV_SOURCE})
set_module_type(ccsetfilesizes_drv kernelmodedriver)
target_link_libraries(ccsetfilesizes_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ccsetfilesizes_drv ntoskrnl hal)
add_target_compile_definitions(ccsetfilesizes_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ccsetfilesizes_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ccsetfilesizes_drv ../include/kmt_test.h)
add_rostests_file(TARGET ccsetfilesizes_drv)

View file

@ -12,7 +12,7 @@ add_library(iocreatefile_drv MODULE ${IOCREATEFILE_DRV_SOURCE})
set_module_type(iocreatefile_drv kernelmodedriver)
target_link_libraries(iocreatefile_drv kmtest_printf ${PSEH_LIB})
add_importlibs(iocreatefile_drv ntoskrnl hal)
add_target_compile_definitions(iocreatefile_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(iocreatefile_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(iocreatefile_drv ../include/kmt_test.h)
add_rostests_file(TARGET iocreatefile_drv)
@ -27,7 +27,7 @@ add_library(iodeviceobject_drv MODULE ${IODEVICEOBJECT_DRV_SOURCE})
set_module_type(iodeviceobject_drv kernelmodedriver)
target_link_libraries(iodeviceobject_drv kmtest_printf ${PSEH_LIB})
add_importlibs(iodeviceobject_drv ntoskrnl hal)
add_target_compile_definitions(iodeviceobject_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(iodeviceobject_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(iodeviceobject_drv ../include/kmt_test.h)
add_rostests_file(TARGET iodeviceobject_drv)
@ -42,7 +42,7 @@ add_library(iohelper_drv MODULE ${IOHELPER_DRV_SOURCE})
set_module_type(iohelper_drv kernelmodedriver)
target_link_libraries(iohelper_drv kmtest_printf ${PSEH_LIB})
add_importlibs(iohelper_drv ntoskrnl hal)
add_target_compile_definitions(iohelper_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(iohelper_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(iohelper_drv ../include/kmt_test.h)
add_rostests_file(TARGET iohelper_drv)
@ -57,6 +57,6 @@ add_library(ioreadwrite_drv MODULE ${IOREADWRITE_DRV_SOURCE})
set_module_type(ioreadwrite_drv kernelmodedriver)
target_link_libraries(ioreadwrite_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ioreadwrite_drv ntoskrnl hal)
add_target_compile_definitions(ioreadwrite_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ioreadwrite_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ioreadwrite_drv ../include/kmt_test.h)
add_rostests_file(TARGET ioreadwrite_drv)

View file

@ -12,7 +12,7 @@ add_library(ntcreatesection_drv MODULE ${NTCREATESECTION_DRV_SOURCE})
set_module_type(ntcreatesection_drv kernelmodedriver)
target_link_libraries(ntcreatesection_drv kmtest_printf ${PSEH_LIB})
add_importlibs(ntcreatesection_drv ntoskrnl hal)
add_target_compile_definitions(ntcreatesection_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(ntcreatesection_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(ntcreatesection_drv ../include/kmt_test.h)
add_rostests_file(TARGET ntcreatesection_drv)
@ -27,6 +27,6 @@ add_library(mmmaplockedpagesspecifycache_drv MODULE ${MMMAPLOCKEDPAGESSPECIFYCAC
set_module_type(mmmaplockedpagesspecifycache_drv kernelmodedriver)
target_link_libraries(mmmaplockedpagesspecifycache_drv kmtest_printf ${PSEH_LIB})
add_importlibs(mmmaplockedpagesspecifycache_drv ntoskrnl hal)
add_target_compile_definitions(mmmaplockedpagesspecifycache_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(mmmaplockedpagesspecifycache_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(mmmaplockedpagesspecifycache_drv ../include/kmt_test.h)
add_rostests_file(TARGET mmmaplockedpagesspecifycache_drv)

View file

@ -12,6 +12,6 @@ add_library(poirp_drv MODULE ${POIRP_DRV_SOURCE})
set_module_type(poirp_drv kernelmodedriver)
target_link_libraries(poirp_drv kmtest_printf ${PSEH_LIB})
add_importlibs(poirp_drv ntoskrnl hal)
add_target_compile_definitions(poirp_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(poirp_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(poirp_drv ../include/kmt_test.h)
add_rostests_file(TARGET poirp_drv)

View file

@ -11,6 +11,6 @@ add_library(tcpip_drv MODULE ${TCPIP_TEST_DRV_SOURCE})
set_module_type(tcpip_drv kernelmodedriver)
target_link_libraries(tcpip_drv kmtest_printf ${PSEH_LIB})
add_importlibs(tcpip_drv ntoskrnl hal)
add_target_compile_definitions(tcpip_drv KMT_STANDALONE_DRIVER)
target_compile_definitions(tcpip_drv PRIVATE KMT_STANDALONE_DRIVER)
#add_pch(example_drv ../include/kmt_test.h)
add_rostests_file(TARGET tcpip_drv)

View file

@ -6,7 +6,7 @@ add_importlibs(pseh2_test msvcrt kernel32 ntdll)
add_rostests_file(TARGET pseh2_test)
if(NOT MSVC)
add_target_compile_flags(pseh2_test "-Wno-format")
target_compile_options(pseh2_test PRIVATE "-Wno-format")
endif()
@ -17,5 +17,5 @@ add_importlibs(pseh2_test_cpp msvcrt kernel32 ntdll)
add_rostests_file(TARGET pseh2_test_cpp)
if(NOT MSVC)
add_target_compile_flags(pseh2_test_cpp "-Wno-format")
target_compile_options(pseh2_test_cpp PRIVATE "-Wno-format")
endif()

View file

@ -18,7 +18,7 @@ list(APPEND SOURCE
add_executable(advapi32_winetest ${SOURCE} testlist.c)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(advapi32_winetest "-Wno-format")
target_compile_options(advapi32_winetest PRIVATE "-Wno-format")
endif()
set_module_type(advapi32_winetest win32cui)

View file

@ -41,7 +41,7 @@ add_executable(comctl32_winetest
rsrc.rc)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(comctl32_winetest "-Wno-format")
target_compile_options(comctl32_winetest PRIVATE "-Wno-format")
endif()
set_module_type(comctl32_winetest win32cui)

View file

@ -49,7 +49,7 @@ add_executable(kernel32_winetest
resource.rc)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(kernel32_winetest "-Wno-format")
target_compile_options(kernel32_winetest PRIVATE "-Wno-format")
endif()
set_module_type(kernel32_winetest win32cui)

View file

@ -28,7 +28,7 @@ list(APPEND SOURCE
add_executable(msvcrt_winetest ${SOURCE} testlist.c)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(msvcrt_winetest "-Wno-format")
target_compile_options(msvcrt_winetest PRIVATE "-Wno-format")
endif()
set_module_type(msvcrt_winetest win32cui)

View file

@ -33,7 +33,7 @@ endif()
add_executable(ntdll_winetest ${SOURCE} testlist.c)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(ntdll_winetest "-Wno-format")
target_compile_options(ntdll_winetest PRIVATE "-Wno-format")
endif()
set_module_type(ntdll_winetest win32cui)

View file

@ -41,9 +41,9 @@ endif()
add_executable(rpcrt4_winetest ${SOURCE})
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(rpcrt4_winetest "-Wno-format")
target_compile_options(rpcrt4_winetest PRIVATE "-Wno-format")
if(USE_CLANG_CL)
add_target_compile_flags(rpcrt4_winetest "-Wno-cast-calling-convention")
target_compile_options(rpcrt4_winetest PRIVATE "-Wno-cast-calling-convention")
endif()
endif()

View file

@ -15,7 +15,7 @@ list(APPEND SOURCE
add_executable(winmm_winetest ${SOURCE})
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(winmm_winetest "-Wno-format")
target_compile_options(winmm_winetest PRIVATE "-Wno-format")
endif()
target_link_libraries(winmm_winetest dxguid)

View file

@ -4,7 +4,7 @@ include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
add_executable(ws2_32_winetest protocol.c sock.c testlist.c)
if(USE_CLANG_CL OR (NOT MSVC))
add_target_compile_flags(ws2_32_winetest "-Wno-format")
target_compile_options(ws2_32_winetest PRIVATE "-Wno-format")
endif()
set_module_type(ws2_32_winetest win32cui)

View file

@ -18,7 +18,7 @@ add_executable(ntkrnlmp
${CMAKE_CURRENT_BINARY_DIR}/ntkrnlmp.def)
set_property(TARGET ntkrnlmp PROPERTY ENABLE_EXPORTS TRUE)
add_target_compile_definitions(ntkrnlmp CONFIG_SMP)
target_compile_definitions(ntkrnlmp PRIVATE CONFIG_SMP)
if(ARCH STREQUAL "i386")
set_entrypoint(ntkrnlmp KiSystemStartup 4)

View file

@ -608,7 +608,7 @@ function(add_importlibs _module)
add_dependency_node(${_module})
foreach(LIB ${ARGN})
if("${LIB}" MATCHES "msvcrt")
add_target_compile_definitions(${_module} _DLL __USE_CRTIMP)
target_compile_definitions(${_module} PRIVATE _DLL __USE_CRTIMP)
target_link_libraries(${_module} msvcrtex)
endif()
target_link_libraries(${_module} lib${LIB})
@ -657,7 +657,7 @@ function(set_module_type MODULE TYPE)
# Set unicode definitions
if(__module_UNICODE)
add_target_compile_definitions(${MODULE} UNICODE _UNICODE)
target_compile_definitions(${MODULE} PRIVATE UNICODE _UNICODE)
endif()
# Set entry point

View file

@ -31,16 +31,7 @@ endfunction()
# arguments, all of which will be added to the list
#
# Examples:
# add_target_compile_flags(mymodule "-pedantic -O5")
# add_target_link_flags(mymodule "-s --fatal-warnings")
# add_target_compile_definitions(mymodule WIN32 _WIN32 INLINE=inline)
# add_target_include_directories(mymodule include ../include)
function(add_target_compile_flags _module _flags)
if(${ARGC} GREATER 2)
message(FATAL_ERROR "Excess arguments to add_target_compile_flags! Module ${_module}, args ${ARGN}")
endif()
add_target_property(${_module} COMPILE_FLAGS ${_flags})
endfunction()
function(add_target_link_flags _module _flags)
if(${ARGC} GREATER 2)
@ -49,14 +40,6 @@ function(add_target_link_flags _module _flags)
add_target_property(${_module} LINK_FLAGS ${_flags})
endfunction()
function(add_target_compile_definitions _module)
add_target_property(${_module} COMPILE_DEFINITIONS ${ARGN})
endfunction()
function(add_target_include_directories _module)
add_target_property(${_module} INCLUDE_DIRECTORIES ${ARGN})
endfunction()
# replace_compiler_option
# (taken from LLVM)
# Replaces a compiler option or switch `_old' in `_var' by `_new'.

View file

@ -231,7 +231,7 @@ elseif(NO_ROSSYM)
else()
# Normal rsym build
get_target_property(RSYM native-rsym IMPORTED_LOCATION_NOCONFIG)
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS} <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
"${RSYM} -s ${REACTOS_SOURCE_DIR} <TARGET> <TARGET>")
@ -323,7 +323,7 @@ function(set_module_type_toolchain MODULE TYPE)
#Disabled due to LD bug: ROSBE-154
#add_linker_script(${MODULE} ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds)
endif()
if(STACK_PROTECTOR)
target_link_libraries(${MODULE} gcc_ssp)
endif()
@ -366,7 +366,7 @@ endfunction()
set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-lib=<TARGET>")
set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-delaylib=<TARGET>")
function(spec2def _dllname _spec_file)
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "VERSION" "" ${ARGN})
# Get library basename
@ -396,7 +396,7 @@ function(spec2def _dllname _spec_file)
if(__spec2def_NO_PRIVATE_WARNINGS)
set(_extraflags --no-private-warnings)
endif()
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags})
endif()
endfunction()
@ -467,7 +467,7 @@ endfunction()
function(allow_warnings __module)
# We don't allow warnings in trunk, this needs to be reworked. See CORE-6959.
#add_target_compile_flags(${__module} "-Wno-error")
#target_compile_options(${__module} PRIVATE "-Wno-error")
endfunction()
macro(add_asm_files _target)

View file

@ -25,7 +25,7 @@ list(APPEND SOURCE
add_library(adns ${SOURCE})
if(NOT MSVC)
add_target_compile_flags(adns "-Wno-unused-but-set-variable")
target_compile_options(adns PRIVATE "-Wno-unused-but-set-variable")
endif()
add_dependencies(adns psdk)

View file

@ -18,7 +18,7 @@ list(APPEND SOURCE
add_library(cardlib ${SOURCE})
if(NOT MSVC)
add_target_compile_flags(cardlib "-Wno-unused-but-set-variable")
target_compile_options(cardlib PRIVATE "-Wno-unused-but-set-variable")
endif()
add_dependencies(cardlib psdk)

View file

@ -61,5 +61,5 @@ list(APPEND SOURCE
add_library(freetype ${SOURCE})
if(USE_CLANG_CL)
add_target_compile_flags(freetype "-Wno-tautological-constant-compare")
target_compile_options(freetype PRIVATE "-Wno-tautological-constant-compare")
endif()

View file

@ -67,11 +67,11 @@ add_library(libxml2 ${SOURCE})
if(MSVC AND (NOT USE_CLANG_CL))
# Unreferenced local variable
replace_compile_flags("/we4101" " ")
add_target_compile_flags(libxml2 "/wd4101")
target_compile_options(libxml2 PRIVATE "/wd4101")
# Local variable initialized but not referenced
replace_compile_flags("/we4189" " ")
else()
add_target_compile_flags(libxml2 "-w")
target_compile_options(libxml2 PRIVATE "-w")
endif()
target_link_libraries(libxml2 oldnames)

View file

@ -48,9 +48,9 @@ add_library(stlport
src/c_locale.c)
if(USE_CLANG_CL)
add_target_compile_flags(stlport "-Wno-missing-braces -Wno-unused-local-typedef")
add_target_compile_flags(stlport "-Wno-infinite-recursion -Wno-deprecated-register")
add_target_compile_flags(stlport "-Wno-tautological-unsigned-zero-compare")
target_compile_options(stlport PRIVATE -Wno-missing-braces -Wno-unused-local-typedef)
target_compile_options(stlport PRIVATE -Wno-infinite-recursion -Wno-deprecated-register)
target_compile_options(stlport PRIVATE -Wno-tautological-unsigned-zero-compare)
endif()
add_dependencies(stlport xdk)

View file

@ -36,13 +36,13 @@ if(CMAKE_CROSSCOMPILING)
add_library(zlib ${SOURCE} ${SOLO_SOURCE})
target_include_directories(zlib PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
add_library(zlib_solo ${SOLO_SOURCE})
add_target_compile_definitions(zlib_solo Z_SOLO)
target_compile_definitions(zlib_solo PRIVATE Z_SOLO)
target_include_directories(zlib_solo PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
add_library(minizip ${MINIZIP_SOURCE})
add_dependencies(minizip psdk)
target_include_directories(minizip PRIVATE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
else()
add_library(zlibhost ${SOLO_SOURCE})
add_target_compile_definitions(zlibhost Z_SOLO)
target_compile_definitions(zlibhost PRIVATE Z_SOLO)
target_include_directories(zlibhost PUBLIC ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
endif()

View file

@ -29,7 +29,7 @@ else()
target_include_directories(cmlibhost INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT MSVC)
add_target_compile_flags(cmlibhost "-fshort-wchar -Wno-multichar")
target_compile_options(cmlibhost PRIVATE -fshort-wchar -Wno-multichar)
endif()
target_link_libraries(cmlibhost PRIVATE host_includes)

View file

@ -47,13 +47,13 @@ add_library(user32_wsprintf
string/wcstombs_nt.c)
add_dependencies(user32_wsprintf psdk)
add_target_compile_definitions(user32_wsprintf _USER32_WSPRINTF)
target_compile_definitions(user32_wsprintf PRIVATE _USER32_WSPRINTF)
add_library(memcmp mem/memcmp.c)
add_dependencies(memcmp psdk)
add_library(getopt misc/getopt.c)
add_target_compile_definitions(getopt _DLL __USE_CRTIMP)
target_compile_definitions(getopt PRIVATE _DLL __USE_CRTIMP)
add_dependencies(getopt psdk)
add_library(strtol
@ -64,7 +64,7 @@ add_library(strtol
string/strtoul.c
string/strtoull.c
string/wctype.c)
add_target_compile_definitions(strtol _LIBCNT_)
target_compile_definitions(strtol PRIVATE _LIBCNT_)
add_dependencies(strtol psdk)

View file

@ -604,8 +604,8 @@ endif()
add_library(crt ${CRT_SOURCE} ${CRT_WINE_SOURCE} ${crt_asm})
target_link_libraries(crt chkstk)
add_target_compile_definitions(crt
__MINGW_IMPORT=extern
target_compile_definitions(crt
PRIVATE __MINGW_IMPORT=extern
USE_MSVCRT_PREFIX
_MSVCRT_LIB_
_MSVCRT_

View file

@ -241,8 +241,8 @@ set_source_files_properties(${LIBCNTPR_ASM_SOURCE} PROPERTIES COMPILE_DEFINITION
add_asm_files(libcntpr_asm ${LIBCNTPR_ASM_SOURCE})
add_library(libcntpr ${LIBCNTPR_SOURCE} ${libcntpr_asm})
add_target_compile_definitions(libcntpr
NO_RTL_INLINES
target_compile_definitions(libcntpr
PRIVATE NO_RTL_INLINES
_NTSYSTEM_
_NTDLLBUILD_
_LIBCNT_

View file

@ -102,7 +102,7 @@ set_source_files_properties(${MSVCRTEX_ASM_SOURCE} PROPERTIES COMPILE_DEFINITION
add_asm_files(msvcrtex_asm ${MSVCRTEX_ASM_SOURCE})
add_library(msvcrtex ${MSVCRTEX_SOURCE} ${msvcrtex_asm})
add_target_compile_definitions(msvcrtex _DLL _MSVCRTEX_)
target_compile_definitions(msvcrtex PRIVATE _DLL _MSVCRTEX_)
set_source_files_properties(startup/crtdll.c PROPERTIES COMPILE_DEFINITIONS CRTDLL)
set_source_files_properties(startup/crtexe.c
startup/wcrtexe.c PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)

View file

@ -26,7 +26,7 @@ else()
target_include_directories(inflibhost INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT MSVC)
add_target_compile_flags(inflibhost "-fshort-wchar -Wpointer-arith -Wwrite-strings")
target_compile_options(inflibhost PRIVATE -fshort-wchar -Wpointer-arith -Wwrite-strings)
endif()
target_link_libraries(inflibhost PRIVATE host_includes)

View file

@ -5,5 +5,5 @@ add_library(lsalib lsa.c)
add_dependencies(lsalib xdk)
add_library(ntlsalib lsa.c)
add_target_compile_definitions(ntlsalib _NTSYSTEM_)
target_compile_definitions(ntlsalib PRIVATE _NTSYSTEM_)
add_dependencies(ntlsalib xdk)

View file

@ -17,8 +17,8 @@ target_link_libraries(hhpcomp)
if(MSVC)
# Disable warning "'x': unreferenced local variable"
add_target_compile_flags(hhpcomp "/wd4101")
target_compile_options(hhpcomp PRIVATE "/wd4101")
# Disable warning "'=': conversion from 'a' to 'b', possible loss of data"
add_target_compile_flags(hhpcomp "/wd4244")
target_compile_options(hhpcomp PRIVATE "/wd4244")
endif()

View file

@ -3,5 +3,5 @@ add_host_tool(hpp hpp.c)
if(MSVC)
# Disable warning "'=': conversion from 'a' to 'b', possible loss of data"
add_target_compile_flags(hpp "/wd4244")
target_compile_options(hpp PRIVATE "/wd4244")
endif()

View file

@ -11,7 +11,7 @@ add_host_tool(mkhive ${SOURCE})
target_include_directories(mkhive PRIVATE ${REACTOS_SOURCE_DIR}/sdk/lib/rtl)
target_compile_definitions(mkhive PRIVATE -DMKHIVE_HOST)
if(NOT MSVC)
add_target_compile_flags(mkhive "-fshort-wchar")
target_compile_options(mkhive PRIVATE "-fshort-wchar")
endif()
target_link_libraries(mkhive PRIVATE host_includes unicode cmlibhost inflibhost)

View file

@ -83,27 +83,27 @@ target_link_libraries(mkisofs libmdigest libschily libsiconv)
if(MSVC)
# mkisofs uses K&R-style function definitions to support very old compilers.
# MSVC complains about the resulting foo() vs. foo(void) mismatches.
add_target_compile_flags(mkisofs "/wd4113")
target_compile_options(mkisofs PRIVATE "/wd4113")
if (ARCH STREQUAL "amd64")
# Disable warning "conversion from 'size_t' to 'int', possible loss of data"
add_target_compile_flags(mkisofs "/wd4267")
target_compile_options(mkisofs PRIVATE "/wd4267")
# Disable warning "'type cast': pointer truncation from 'const char *' to 'long'"
add_target_compile_flags(libschily "/wd4311")
target_compile_options(libschily PRIVATE "/wd4311")
endif()
# Disable warning "'<': signed/unsigned mismatch"
add_target_compile_flags(mkisofs "/wd4018")
target_compile_options(mkisofs PRIVATE "/wd4018")
# Disable warning "'nchar': unreferenced local variable"
add_target_compile_flags(mkisofs "/wd4101")
target_compile_options(mkisofs PRIVATE "/wd4101")
# Disable warning "'+=': conversion from 'x' to 'y', possible loss of data"
add_target_compile_flags(libschily "/wd4244")
add_target_compile_flags(mkisofs "/wd4244")
target_compile_options(libschily PRIVATE "/wd4244")
target_compile_options(mkisofs PRIVATE "/wd4244")
else()
# libschily implements an own printf function with support for the %r formatter.
# Silence compilers checking for invalid formatting sequences.
add_target_compile_flags(libschily "-Wno-format")
target_compile_options(libschily PRIVATE "-Wno-format")
endif()

View file

@ -89,11 +89,11 @@ target_link_libraries(unicode PRIVATE host_includes)
if(MSVC)
# Disable warning "'<': signed/unsigned mismatch"
add_target_compile_flags(unicode "/wd4018")
target_compile_options(unicode PRIVATE "/wd4018")
# Disable warning "unary minus operator applied to unsigned type, result still unsigned"
add_target_compile_flags(unicode "/wd4146")
target_compile_options(unicode PRIVATE "/wd4146")
# Disable warning "conversion from 'const WCHAR' to 'char', possible loss of data"
add_target_compile_flags(unicode "/wd4244")
target_compile_options(unicode PRIVATE "/wd4244")
endif()

View file

@ -38,11 +38,11 @@ target_link_libraries(widl PRIVATE host_includes wpphost)
if(MSVC)
# Disable warning "'>': signed/unsigned mismatch"
add_target_compile_flags(widl "/wd4018")
target_compile_options(widl PRIVATE "/wd4018")
# Disable warning "unary minus operator applied to unsigned type, result still unsigned"
add_target_compile_flags(widl "/wd4146")
target_compile_options(widl PRIVATE "/wd4146")
# Disable warning "'=': conversion from 'a' to 'b', possible loss of data"
add_target_compile_flags(widl "/wd4244")
target_compile_options(widl PRIVATE "/wd4244")
endif()

View file

@ -17,7 +17,7 @@ target_link_libraries(xml2sdb PRIVATE host_includes)
if(MSVC)
# Disable warning "'=': conversion from 'a' to 'b', possible loss of data"
add_target_compile_flags(xml2sdb "/wd4244")
target_compile_options(xml2sdb PRIVATE "/wd4244")
else()
add_target_compile_flags(xml2sdb "-fshort-wchar")
target_compile_options(xml2sdb PRIVATE "-fshort-wchar")
endif()

View file

@ -24,7 +24,7 @@ list(APPEND SOURCE
add_executable(spoolsv ${SOURCE} spoolsv.rc)
if(USE_CLANG_CL)
add_target_compile_flags(spoolsv "-Wno-cast-calling-convention")
target_compile_options(spoolsv PRIVATE "-Wno-cast-calling-convention")
endif()
set_module_type(spoolsv win32cui UNICODE)

View file

@ -45,10 +45,10 @@ list(APPEND CONSRV_SOURCE
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
if(MSVC)
## NOTE: No need to specify it as we use MSVC :)
##add_target_compile_flags(consrv "/Ze")
##target_compile_options(consrv PRIVATE "/Ze")
#set_source_files_properties(${CONSRV_SOURCE} PROPERTIES COMPILE_FLAGS "/Ze")
else()
#add_target_compile_flags(consrv "-fms-extensions")
#target_compile_options(consrv PRIVATE "-fms-extensions")
set_source_files_properties(${CONSRV_SOURCE} PROPERTIES COMPILE_FLAGS "-fms-extensions")
endif()