Details
Description
When compiling with cmake 4.4 I get the following warning:
[cmake] CMake Warning (policy) at cmake/plugin.cmake:342 (IF):
|
[cmake] Policy CMP0218 is not set: The CMAKE_WARN_DEPRECATED and
|
[cmake] CMAKE_ERROR_DEPRECATED variables are ignored. Run "cmake --help-policy
|
[cmake] CMP0218" for policy details. Use the cmake_policy command to set the
|
[cmake] policy and suppress this warning.
|
[cmake] Call Stack (most recent call first):
|
[cmake] CMakeLists.txt:490 (CONFIGURE_PLUGINS)
|
[cmake] This warning is for project developers. Use -Wno-author or -Wno-policy to
|
[cmake] suppress it.
|
[cmake]
|
[cmake] CMake Warning (policy) at cmake/plugin.cmake:342 (IF):
|
[cmake] Policy CMP0218 is not set: The CMAKE_WARN_DEPRECATED and
|
[cmake] CMAKE_ERROR_DEPRECATED variables are ignored. Run "cmake --help-policy
|
[cmake] CMP0218" for policy details. Use the cmake_policy command to set the
|
[cmake] policy and suppress this warning.
|
[cmake] Call Stack (most recent call first):
|
[cmake] CMakeLists.txt:490 (CONFIGURE_PLUGINS)
|
[cmake] This warning is for project developers. Use -Wno-author or -Wno-policy to
|
[cmake] suppress it.
|
[cmake]
|
[cmake] -- Configuring done (1.8s)
|
[cmake] -- Generating done (0.9s)
|
[cmake] -- Build files have been written to: /Users/gkodinov/dev/server-10.11/bld
|
This is about the following fragment in cmake/plugin.cmake:
GET_CMAKE_PROPERTY(ALL_VARS VARIABLES)
|
FOREACH (V ${ALL_VARS})
|
IF (V MATCHES "^PLUGIN_" AND ${V} MATCHES "YES")
|
STRING(SUBSTRING ${V} 7 -1 plugin)
|
STRING(TOLOWER ${plugin} target)
|
IF (NOT TARGET ${target})
|
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
|
ENDIF()
|
ENDIF()
|
ENDFOREACH()
|
It looks like cmake always evaluates all conditions in a IF() statement even if the LHS of an AND is FALSE. So you get a warning as a result because of the CMAKE_WARN_DEPRECATED variable.
The fix is to break the IF():
GET_CMAKE_PROPERTY(ALL_VARS VARIABLES)
|
FOREACH (V ${ALL_VARS})
|
IF (V MATCHES "^PLUGIN_")
|
IF (${V} MATCHES "YES")
|
STRING(SUBSTRING ${V} 7 -1 plugin)
|
STRING(TOLOWER ${plugin} target)
|
IF (NOT TARGET ${target})
|
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
|
ENDIF()
|
ENDIF()
|
ENDIF()
|
ENDFOREACH()
|