Merge 'cmake: sync with configure.py (10/n)' from Kefu Chai

- build: cmake: use different names for output of check_cxx_compiler_flag
- build: cmake: only add supported warning flags to CMAKE_CXX_FLAGS
- build: cmake: limit the number of link job

Closes #13098

* github.com:scylladb/scylladb:
  build: cmake: limit the number of link job
  build: cmake: only add supported warning flags to CMAKE_CXX_FLAGS
  build: cmake: use different names for output of check_cxx_compiler_flag
This commit is contained in:
Botond Dénes
2023-03-07 14:24:26 +02:00
3 changed files with 22 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ include("mode.${build_mode}")
add_compile_definitions(
${Seastar_DEFINITIONS_${build_mode}}
FMT_DEPRECATED_OSTREAM)
include("limit_jobs")
# Configure Seastar compile options to align with Scylla
set(CMAKE_CXX_STANDARD "20" CACHE INTERNAL "")
set(CMAKE_CXX_EXTENSIONS ON CACHE INTERNAL "")

16
cmake/limit_jobs.cmake Normal file
View File

@@ -0,0 +1,16 @@
set(Seastar_LINK_MEM_PER_JOB 1024 CACHE INTERNAL "Maximum memory used by each link job in (in MiB)")
cmake_host_system_information(
RESULT _total_mem
QUERY AVAILABLE_PHYSICAL_MEMORY)
math(EXPR _link_pool_depth "${_total_mem} / ${Seastar_LINK_MEM_PER_JOB}")
if(_link_pool_depth EQUAL 0)
set(_link_pool_depth 1)
endif()
set_property(
GLOBAL
APPEND
PROPERTY JOB_POOLS
link_pool=${_link_pool_depth}
submodule_pool=1)
set(CMAKE_JOB_POOL_LINK link_pool)

View File

@@ -6,14 +6,14 @@ set(disabled_warnings
parentheses-equality
unsupported-friend)
include(CheckCXXCompilerFlag)
foreach(warning disabled_warnings)
check_cxx_compiler_flag("-Wno-${warning}" _warning_supported)
if(_warning_supported)
foreach(warning ${disabled_warnings})
check_cxx_compiler_flag("-Wno-${warning}" _warning_supported_${warning})
if(_warning_supported_${warning})
list(APPEND _supported_warnings ${warning})
endif()
endforeach()
list(TRANSFORM disabled_warnings PREPEND "-Wno-")
string(JOIN " " CMAKE_CXX_FLAGS "-Wall" "-Werror" ${disabled_warnings})
list(TRANSFORM _supported_warnings PREPEND "-Wno-")
string(JOIN " " CMAKE_CXX_FLAGS "-Wall" "-Werror" ${_supported_warnings})
function(default_target_arch arch)
set(x86_instruction_sets i386 i686 x86_64)