GNUInstallDirs module raise warning when used in pure CMake project
I have a pure CMake project that uses GNUInstallDirs
module to install files to CMAKE_INSTALL_DATADIR
. In both CMake 3.22.1 and 3.23.1, this raise a warning:
CMake Warning (dev) at /home/straversaro/mambaforge/envs/cmake/share/cmake-3.23/Modules/GNUInstallDirs.cmake:241 (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:3 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/straversaro/testgid/buildconda
It is possible to easily reproduce the problem with this CMakeLists.txt
:
cmake_minimum_required(VERSION 3.16)
project(PureCMakeProject VERSION 1.0 LANGUAGES NONE)
include(GNUInstallDirs)
Not sure if this is a problem of documentation or of GNUInstallDirs
module, but I am not sure how I am supposed to fix the warning:
- the project that I am building does not have any C or C++ code, so it does not make sense to add
C
orCXX
to languages - on the other hand, it is totaly fine for a
LANGUAGES NONE
project to use someGNUInstallDirs