¿Cómo diseñar un módulo CMake FindOoxx personalizado con versiones como FindQT4?

StackOverflow https://stackoverflow.com/questions/4851825

  •  27-10-2019
  •  | 
  •  

Pregunta

Me gustaría diseñar un módulo CMake FindOoXX para Autodesk Maya con soporte de versiones, al igual que lo que proporciona Findqt4.Cmake. ex,

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

¿Alguien tiene una muestra de módulo CMake simple pero completa como esta?

¿Fue útil?

Solución

En el directorio de módulos Cmake hay un archivo readme.txt que contiene información útil para escritores de módulos CMake. Esta es la sección relevante de ese archivo sobre cómo se pasan los números de versión al módulo:

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

Otros consejos

Puede encontrar el script QT4 Find Script en su carpeta de instalación de CMake en los módulos Share CMake-2.8 .

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top