在CMake模塊目錄中有一個文件readme.txt
,其中包含CMake模塊編寫器的有用信息。這是該文件中關於如何將版本號傳遞給模塊的相關部分:
If any version numbers are given to the command it will set the
following variables before loading the module:
XXX_FIND_VERSION = full requested version string
XXX_FIND_VERSION_MAJOR = major version if requested, else 0
XXX_FIND_VERSION_MINOR = minor version if requested, else 0
XXX_FIND_VERSION_PATCH = patch version if requested, else 0
XXX_FIND_VERSION_TWEAK = tweak version if requested, else 0
XXX_FIND_VERSION_COUNT = number of version components, 0 to 4
XXX_FIND_VERSION_EXACT = true if EXACT option was given
非常感謝!這真的有助於獲得這個變量引用。 – Drake 2011-02-04 04:13:09