Skip to content

[Bug]: Abseil CMake try_compile calls are unnecessary #2023

@Shadows-of-Fire

Description

@Shadows-of-Fire

Describe the issue

Abseil, in AbseilDLL.cmake, makes two check_cxx_source_compiles calls to determine the CXX feature set of the current compiler. These calls are expensive (running try_compile builds and links an entire executable, taking a few seconds), and cannot be disabled.

More importantly, if the user has already configured the project with CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED, then CMake will be responsible for enforcing the language standard and abseil does not need to run additional try_compiles to verify the specified standard.

I would expect, if CMAKE_CXX_STANDARD is specified, that abseil does not run these try_compile calls and instead relies on CMAKE_CXX_STANDARD to determine language features.

Steps to reproduce the problem

Configure the project via cmake. Observe two try_compile runs to determine ABSL_INTERNAL_AT_LEAST_CXX17 and ABSL_INTERNAL_AT_LEAST_CXX20

What version of Abseil are you using?

master e72b94a

What operating system and version are you using?

Rocky Linux 8.10

What compiler and version are you using?

GCC 11.2

What build system are you using?

CMake 3.31

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions