我将CMake用于我的项目,并且依赖于多个不同的第三方库,它们本身都使用CMake。
其中许多在其主要CMake中提供Options
,例如-
option(GLM_QUIET "No CMake Message" OFF)
option(BUILD_SHARED_LIBS "Build shared library" ON)
option(BUILD_STATIC_LIBS "Build static library" ON)
option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
option ( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library."
ON
)
option ( ASSIMP_BUILD_SAMPLES
"If the official samples are built as well (needs Glut)."
OFF
)
默认情况下,我想将其中一些选项设置为与原始值不同。
在包含主要的CMake之前,我尝试过这样设置它们-
SET( ASSIMP_BUILD_ASSIMP_TOOLS OFF )
但随后我从CMake收到此错误:
CMake Warning (dev) at Thirdparty/glm/CMakeLists.txt:14 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'ASSIMP_BUILD_ASSIMP_TOOLS '.
This warning is for project developers. Use -Wno-dev to suppress it.
如果我尝试这样做-
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS OFF )
它只是悄悄地忽略了它。
解决这个问题的正确方法是什么?