Skip to content

[suggestion] Disable modules support by default #327

@uilianries

Description

@uilianries

Greetings!

Since version 1.0.0 a large number of features were introduced, including support for C++ modules, which is great in terms of adoption for newer compilers.

However, using this feature enabled by default, there is a side-effect of needing to build with Ninja, or an equivalent supported build system. For instance, Unix Makefile and it will result in the following error during the setup when used with GCC-15 + C++20:

-- Configuring done (2.0s)
CMake Error in CMakeLists.txt:
  The target named "cpptrace-lib" has C++ sources that may use modules, but
  modules are not supported by this generator:

    Unix Makefiles

  Modules are supported only by Ninja, Ninja Multi-Config, and Visual Studio
  generators for VS 17.4 and newer.  See the cmake-cxxmodules(7) manual for
  details.  Use the CMAKE_CXX_SCAN_FOR_MODULES variable to enable or disable
  scanning.


-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

As cpptrace is packaged in Conan Center and there are people consuming from there, we received two reports targeting this very same situation: Using GCC-15 + C++20 + CMake, they can not build using the default generator. Please, take a look at the issue / PR for more context:


Most of the other package managers did not reach the same error because either they are using Ninja, or they don't use a newer compiler with C++20.

My current suggestion is to disable C++ Modules by default, by using CPPTRACE_DISABLE_CXX_20_MODULES=ON: https://github.com/jeremy-rifkin/cpptrace/blob/v1.0.4/cmake/OptionVariables.cmake

In this way, it will be much simpler than forcing users to also install Ninja or having to configure their environment to use a different build generator.

Regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions