xmos / xcommon_cmake

6 stars 5 forks source link

CMake warning with v3.30 and later #190

Open danielpieczko opened 1 month ago

danielpieczko commented 1 month ago

If using CMake v3.30 or later, a warning is printed when running for an XCommon CMake application:

$> cmake -B build -G "Unix Makefiles"
CMake Warning (dev) at /<xtc-path>/15.3.0/XMOS/XTC/15.3.0/build/xcommon_cmake/xcommon.cmake:34 (enable_language):
  project() should be called prior to this enable_language() call.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The CXX compiler identification is Clang 3.6.0
-- The C compiler identification is Clang 3.6.0
-- The ASM compiler identification is XCC
...
danielpieczko commented 1 month ago

This warning can be suppressed by putting the following inside xcommon.cmake before the enable_language() call:

if(POLICY CMP0165)
    cmake_policy(SET CMP0165 OLD)
endif()