Skip to content

Overzealous /permissive- breaks cross-compiled builds #364

@nyoma-diamond

Description

@nyoma-diamond

Currently, the usage of target_compile_options(fast_float INTERFACE /permissive-) when the host compiler allows /permissive (as validated by CHECK_CXX_COMPILER_FLAG(/permissive- FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE)) is overzealous and breaks cross-compiled builds. For example, if the host is built using MSVC, but the downstream uses any non-MSVC compiler, compiling will fail with an error such as this:

clang: error: no such file or directory: '/permissive-'

This is an extension of #304/#305, which fixed a different edge of this issue.

With the current approach (using target_compile_options(fast_float INTERFACE /permissive-)) the compiler flag gets propagated forward into the generated fast_floats-targets.cmake at build-time:

set_target_properties(FastFloat::fast_float PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_11"
  INTERFACE_COMPILE_OPTIONS "/permissive-"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

Which erroneously forces the consumer to use the /permissive- flag even if it's not relevant for the downstream compiler.

This issue is particularly relevant when working with fast_float via vcpkg, as vcpkg makes it very easy to set up cross-compiling by building for the host development system with their compiler of choice, and then compile for the target using a different relevant compiler, allowing development for other OS's or to allow special compiler-specific features to be enabled/disabled at build time (in my case, my target builds are done using Clang++ as I need some of its features, but my host uses MSVC for speed and ease of setup).

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