Skip to content

GNUInstallDirs warning when only enabling the Swift language

On a project with only the Swift language enabled, including GNUInstallDirs results in this warning:

GNUInstallDirs requires either C or C++ be enabled to work correctly.

CMake Warning (dev) at ...share/cmake-3.30/Modules/GNUInstallDirs.cmake:253 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  CMakeLists.txt:18 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

Sample project to repro:

project(dummy-project LANGUAGES Swift)
include(GNUInstallDirs)

A workaround is to also include the C language, but we should not have to do that.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information