Skip to content

Commit

Permalink
Also suppress Absl warnigs.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Mar 23, 2024
1 parent 805b683 commit 5b54ad8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/Abseil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ macro(p4c_obtain_abseil)
)
fetchcontent_makeavailable_but_exclude_install(abseil)

# Suppress warnings for all Abseil targets.
get_all_targets(ABSL_BUILD_TARGETS ${absl_BINARY_DIR})
foreach(target in ${ABSL_BUILD_TARGETS})
if(target MATCHES "absl_*")
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-Wno-error -w")
endif()
endforeach()

# Reset temporary variable modifications.
set(CMAKE_UNITY_BUILD ${CMAKE_UNITY_BUILD_PREV})
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
Expand Down
15 changes: 15 additions & 0 deletions cmake/P4CUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,18 @@ macro(fetchcontent_makeavailable_but_exclude_install content)
add_subdirectory(${${content}_SOURCE_DIR} ${${content}_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endmacro(fetchcontent_makeavailable_but_exclude_install)

# Collect all currently added targets in all subdirectories
#
# Parameters: - _result the list containing all found targets - _dir root directory to start
# looking from
# Sourced from https://stackoverflow.com/a/60232044
function(get_all_targets _result _dir)
get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
foreach(_subdir IN LISTS _subdirs)
get_all_targets(${_result} "${_subdir}")
endforeach()

get_directory_property(_sub_targets DIRECTORY "${_dir}" BUILDSYSTEM_TARGETS)
set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
endfunction()

0 comments on commit 5b54ad8

Please sign in to comment.