From e16edaa99e0a93630e2328513dbc9ce4d19e7123 Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Wed, 31 Aug 2016 15:51:40 -0700 Subject: [PATCH] FindPTex.cmake: enable discovery of newer versions of ptex --- cmake/FindPTex.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/FindPTex.cmake b/cmake/FindPTex.cmake index 8be63192..7eefe8e4 100644 --- a/cmake/FindPTex.cmake +++ b/cmake/FindPTex.cmake @@ -101,15 +101,20 @@ else () DOC "The Ptex library") endif () -if (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" ) +if (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/PtexVersion.h" ) + set(PTEX_VERSION_FILE "${PTEX_INCLUDE_DIR}/PtexVersion.h") +elseif (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" ) + set(PTEX_VERSION_FILE "${PTEX_INCLUDE_DIR}/Ptexture.h") +endif() - file(STRINGS "${PTEX_INCLUDE_DIR}/Ptexture.h" TMP REGEX "^#define PtexAPIVersion.*$") +if (PTEX_VERSION_FILE) + file(STRINGS "${PTEX_VERSION_FILE}" TMP REGEX "^#define PtexAPIVersion.*$") string(REGEX MATCHALL "[0-9]+" API ${TMP}) - file(STRINGS "${PTEX_INCLUDE_DIR}/Ptexture.h" TMP REGEX "^#define PtexFileMajorVersion.*$") + file(STRINGS "${PTEX_VERSION_FILE}" TMP REGEX "^#define PtexFileMajorVersion.*$") string(REGEX MATCHALL "[0-9]+" MAJOR ${TMP}) - file(STRINGS "${PTEX_INCLUDE_DIR}/Ptexture.h" TMP REGEX "^#define PtexFileMinorVersion.*$") + file(STRINGS "${PTEX_VERSION_FILE}" TMP REGEX "^#define PtexFileMinorVersion.*$") string(REGEX MATCHALL "[0-9]+" MINOR ${TMP}) set(PTEX_VERSION ${API}.${MAJOR}.${MINOR})