我正在尝试使用CMake 3.3中的新逻辑来检查值是否在列表中
cmake_minimum_required(VERSION 3.3)
cmake_policy(SET CMP0057 NEW)
set(l A B C)
foreach( e ${l} )
if( ${e} IN_LIST "${l}" )
message( "element ${e} found in ${l}" )
else()
message( "element ${e} NOT found in ${l}" )
endif()
endforeach()
在OSX Yosemite上使用CMake 3.4.3运行此操作会产生意外结果:
$ cmake -P cmakeBug.cmake
element A NOT found in A;B;C
element B NOT found in A;B;C
element C NOT found in A;B;C
我是否遗漏了一些微不足道的内容,或者CMake中是否有错误?