2011-01-31 52 views
1

我想为Autodesk Maya设计一个cmake FindOOXX模块,支持版本控制,就像FindQt4.cmake提供的一样。 ex,如何使用FindQt4等版本设计定制cmake FindOOXX模块?

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

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

回答

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 
+0

非常感谢!这真的有助于获得这个变量引用。 – Drake 2011-02-04 04:13:09

0

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

+0

我做了,但对我来说太复杂了; p – Drake 2011-01-31 16:02:42