好吧,我总是很难理解 cmake 文档,但关于 set_property 我无法理解,尤其是在这个例子中,取自 Openpose 的 CMakeLists。
# Select the DL Framework
set(DL_FRAMEWORK CAFFE CACHE STRING "Select Deep Learning Framework.")
if (WIN32)
set_property(CACHE DL_FRAMEWORK PROPERTY STRINGS CAFFE)
else (WIN32)
set_property(CACHE DL_FRAMEWORK PROPERTY STRINGS CAFFE NV_CAFFE)
# set_property(CACHE DL_FRAMEWORK PROPERTY STRINGS CAFFE NV_CAFFE PYTORCH TENSORFLOW)
endif (WIN32)
# Suboptions for Caffe DL Framework
include(CMakeDependentOption)
if (${DL_FRAMEWORK} MATCHES "CAFFE" OR ${DL_FRAMEWORK} MATCHES "NV_CAFFE")
CMAKE_DEPENDENT_OPTION(BUILD_CAFFE "Build Caffe as part of OpenPose." ON
"DL_FRAMEWORK" ON)
# OpenPose flags
add_definitions(-DUSE_CAFFE)
# Nvidia NVCaffe
if (${DL_FRAMEWORK} MATCHES "NV_CAFFE")
MESSAGE(STATUS "Using NVIDIA NVCaffe")
add_definitions(-DNV_CAFFE)
endif (${DL_FRAMEWORK} MATCHES "NV_CAFFE")
endif (${DL_FRAMEWORK} MATCHES "CAFFE" OR ${DL_FRAMEWORK} MATCHES "NV_CAFFE")
我确实了解 CACHE 变量,但是这两个 set_property 的效果是什么,因为变量 ${DL_FRAMEWORK} 似乎被检查为纯文本,如“CAFFE”或“NV_CAFFE”。
这是完整的 CMakeLists.txt: https ://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/CMakeLists.txt
我也可能误解了属性是如何工作的。
谢谢你的时间!