如何使用像FindQt4这样的版本设计自定义cmake FindOOXX模块?

时间:2011-01-31 14:10:41

标签: cmake maya

我想为Autodesk Maya设计一个cmake FindOOXX模块,支持版本控制,就像FindQt4.cmake提供的那样。前,

find_package(Qt4 4.4.3)
include(${QT_USE_FILE})
add_executable(myexe main.cpp)
target_link_libraries(myexe ${QT_LIBRARIES})

有没有人有像这样简单但完整的cmake模块样本?

2 个答案:

答案 0 :(得分:2)

在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

答案 1 :(得分:0)

您可以在share \ cmake-2.8 \ Modules下的CMake安装文件夹中找到Qt4查找脚本。