mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:35:40 +00:00
[CMAKE] Get rid of add_compile_flags_language macro
in favor of add_compile_options and the like with generator expressions Also take this as an opportunity to remove the C++11 standard hack, GCC 8 now defaults to C++14
This commit is contained in:
parent
7e116f0ef3
commit
ed61512236
19 changed files with 20 additions and 103 deletions
|
@ -1,10 +1,5 @@
|
|||
PROJECT(CHARMAP)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
includes)
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_flags("-Wno-restrict")
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCE
|
||||
src/ansiprsr.cpp
|
||||
src/keytrans.cpp
|
||||
|
@ -27,13 +21,13 @@ list(APPEND SOURCE
|
|||
src/ttelhndl.cpp
|
||||
precomp.h)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_flags_language("-Wno-narrowing" "CXX")
|
||||
endif()
|
||||
|
||||
add_executable(telnet ${SOURCE} telnet.rc)
|
||||
target_link_libraries(telnet cppstl)
|
||||
set_target_cpp_properties(telnet WITH_EXCEPTIONS)
|
||||
if (NOT MSVC)
|
||||
target_compile_options(telnet PRIVATE -Wno-restrict $<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
|
||||
target_compile_definitions(telnet PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
set_module_type(telnet win32cui)
|
||||
add_importlibs(telnet ws2_32 user32 msvcrt kernel32 ntdll)
|
||||
add_pch(telnet precomp.h SOURCE)
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
project(appcompat)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp
|
||||
${REACTOS_SOURCE_DIR})
|
||||
|
|
|
@ -3,11 +3,6 @@ spec2def(mydocs.dll mydocs.spec)
|
|||
add_definitions(
|
||||
-D_WINE)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE mydocs_rc_deps res/*.*)
|
||||
add_rc_deps(mydocs.rc ${mydocs_rc_deps})
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
|
||||
project(SHELL)
|
||||
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11 -Wshadow" "CXX")
|
||||
endif()
|
||||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
project(SHELL)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
spec2def(ntobjshex.dll ntobjshex.spec)
|
||||
|
||||
file(GLOB_RECURSE ntobjshex_rc_deps resources/*.*)
|
||||
|
|
|
@ -3,11 +3,6 @@ spec2def(sendmail.dll sendmail.spec)
|
|||
add_definitions(
|
||||
-D_WINE)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE sendmail_rc_deps res/*.*)
|
||||
add_rc_deps(sendmail.rc ${sendmail_rc_deps})
|
||||
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x603)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/drivers/filesystems/btrfs)
|
||||
|
||||
spec2def(shellbtrfs.dll shellbtrfs.spec)
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
project(SHELL)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
spec2def(stobject.dll stobject.spec)
|
||||
|
||||
file(GLOB_RECURSE stobject_rc_deps resources/*.*)
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
|
@ -13,7 +8,6 @@ include_directories(
|
|||
|
||||
spec2def(zipfldr.dll zipfldr.spec ADD_IMPORTLIB)
|
||||
|
||||
|
||||
list(APPEND SOURCE
|
||||
zipfldr.cpp
|
||||
zippidl.cpp
|
||||
|
@ -40,7 +34,6 @@ add_library(zipfldr MODULE
|
|||
zipfldr.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/zipfldr.def)
|
||||
|
||||
|
||||
set_module_type(zipfldr win32dll UNICODE)
|
||||
target_link_libraries(zipfldr minizip zlib uuid cpprt atl_classes)
|
||||
set_target_cpp_properties(zipfldr WITH_EXCEPTIONS)
|
||||
|
|
|
@ -2,11 +2,6 @@ PROJECT(DEVMGR)
|
|||
|
||||
spec2def(devmgr.dll devmgr.spec ADD_IMPORTLIB)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${REACTOS_SOURCE_DIR}/sdk/include/reactos/dll
|
||||
includes)
|
||||
|
|
|
@ -6,11 +6,6 @@ add_subdirectory(shellrecyclebin)
|
|||
|
||||
spec2def(shell32.dll shell32.spec ADD_IMPORTLIB)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
|
|
|
@ -27,12 +27,13 @@ add_cd_file(TARGET netkvm DESTINATION reactos/system32/drivers FOR all)
|
|||
add_driver_inf(netkvm netkvm.inf)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_flags("-Wno-unused-function")
|
||||
add_compile_flags("-Wno-old-style-declaration")
|
||||
add_compile_flags("-Wno-unknown-pragmas")
|
||||
add_compile_flags("-Wno-unused-but-set-variable")
|
||||
add_compile_flags("-Wno-pointer-sign")
|
||||
add_compile_flags("-Wno-pointer-to-int-cast")
|
||||
add_compile_flags("-Wno-int-to-pointer-cast")
|
||||
add_compile_flags("-Wno-attributes")
|
||||
target_compile_options(netkvm PRIVATE
|
||||
-Wno-unused-function
|
||||
-Wno-old-style-declaration
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-pointer-sign
|
||||
-Wno-pointer-to-int-cast
|
||||
-Wno-int-to-pointer-cast
|
||||
-Wno-attributes)
|
||||
endif()
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
includes)
|
||||
|
||||
|
@ -15,6 +10,7 @@ list(APPEND SOURCE
|
|||
testlist.c)
|
||||
|
||||
add_executable(browseui_apitest ${SOURCE})
|
||||
|
||||
target_link_libraries(browseui_apitest uuid wine cpprt atl_classes)
|
||||
set_target_cpp_properties(browseui_apitest WITH_EXCEPTIONS WITH_RTTI)
|
||||
set_module_type(browseui_apitest win32cui)
|
||||
|
|
|
@ -71,13 +71,11 @@ macro(replace_compiler_option _var _old _new)
|
|||
endmacro(replace_compiler_option)
|
||||
|
||||
# add_compile_flags
|
||||
# add_compile_flags_language
|
||||
# Add or replace compiler flags in the global scope for either all source
|
||||
# files or only those of the specified language.
|
||||
#
|
||||
# Examples:
|
||||
# add_compile_flags("-pedantic -O5")
|
||||
# add_compile_flags_language("-std=gnu99" "C")
|
||||
function(add_compile_flags _flags)
|
||||
if(${ARGC} GREATER 1)
|
||||
message(FATAL_ERROR "Excess arguments to add_compile_flags! Args ${ARGN}")
|
||||
|
@ -87,12 +85,3 @@ function(add_compile_flags _flags)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" PARENT_SCOPE)
|
||||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(add_compile_flags_language _flags _lang)
|
||||
if(NOT ${ARGC} EQUAL 2)
|
||||
message(FATAL_ERROR "Wrong arguments to add_compile_flags_language! Args ${ARGN}")
|
||||
endif()
|
||||
# Adds the compiler flag for the specified language only, e.g. CMAKE_C_FLAGS
|
||||
set(CMAKE_${_lang}_FLAGS "${CMAKE_${_lang}_FLAGS} ${_flags}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ add_compile_flags("-mstackrealign")
|
|||
add_compile_flags("-fno-aggressive-loop-optimizations")
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_flags_language("-std=gnu99 -Wno-microsoft" "C")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-std=gnu99;-Wno-microsoft>")
|
||||
set(CMAKE_LINK_DEF_FILE_FLAG "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_LINK_LIBRARY_SUFFIX "")
|
||||
|
@ -65,7 +65,7 @@ endif()
|
|||
|
||||
if(DBG)
|
||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_flags_language("-Wold-style-declaration" "C")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Wold-style-declaration>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -125,8 +125,7 @@ endif()
|
|||
add_compile_flags("/w14115")
|
||||
|
||||
if(USE_CLANG_CL)
|
||||
add_compile_flags_language("-nostdinc -Wno-multichar -Wno-char-subscripts -Wno-microsoft-enum-forward-reference -Wno-pragma-pack -Wno-microsoft-anon-tag -Wno-parentheses-equality -Wno-unknown-pragmas" "C")
|
||||
add_compile_flags_language("-nostdinc -Wno-multichar -Wno-char-subscripts -Wno-microsoft-enum-forward-reference -Wno-pragma-pack -Wno-microsoft-anon-tag -Wno-parentheses-equality -Wno-unknown-pragmas" "CXX")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:-nostdinc;-Wno-multichar;-Wno-char-subscripts;-Wno-microsoft-enum-forward-reference;-Wno-pragma-pack;-Wno-microsoft-anon-tag;-Wno-parentheses-equality;-Wno-unknown-pragmas>")
|
||||
endif()
|
||||
|
||||
# Debugging
|
||||
|
|
|
@ -6,10 +6,10 @@ endfunction()
|
|||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_IO_H=1)
|
||||
add_compile_flags_language("/EHsc" "CXX")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/EHsc>")
|
||||
|
||||
# Disable warning "conversion from 'size_t' to 'int', possible loss of data"
|
||||
add_compile_flags("/wd4267")
|
||||
add_compile_options("/wd4267")
|
||||
endif()
|
||||
|
||||
add_host_tool(bin2c bin2c.c)
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
|
||||
set(USE_DIBLIB FALSE)
|
||||
|
||||
if(NOT MSVC)
|
||||
# HACK: this should be enabled globally!
|
||||
add_compile_flags_language("-std=c++11" "CXX")
|
||||
endif()
|
||||
|
||||
# Give WIN32 subsystem its own project.
|
||||
PROJECT(WIN32SS)
|
||||
|
||||
|
@ -247,4 +242,4 @@ set_source_files_properties(sys-stubs.S PROPERTIES OBJECT_DEPENDS ${CMAKE_CURREN
|
|||
add_asm_files(win32ksys_asm sys-stubs.S)
|
||||
add_library(win32ksys ${win32ksys_asm})
|
||||
set_target_properties(win32ksys PROPERTIES LINKER_LANGUAGE "C")
|
||||
add_dependencies(win32ksys asm)
|
||||
add_dependencies(win32ksys asm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue