From 27ba604ad793ea14bbaa2ec53e19d019b5941034 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Sun, 27 Nov 2011 22:27:50 +0000 Subject: [PATCH] [trunk] search for kdu_expand in a more cmake-compliant way --- CMakeLists.txt | 13 +++++++++---- tests/nonregression/CMakeLists.txt | 9 ++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b23f2160..3145fc13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,10 +219,15 @@ IF(BUILD_TESTING) $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data ) - - # For encoding tests we need the path to the ref decoder exe/lib (kakadu) - SET (REF_DECODER_BIN_PATH "NOTFOUND" CACHE PATH "Single directory where find the reference decoder binaries to enable encoding test suite.") - MARK_AS_ADVANCED(REF_DECODER_BIN_PATH) + + # For encoding tests we need the path to the ref decoder exe/lib (kakadu) + FIND_PROGRAM(REF_DECODER_BIN + NAMES kdu_expand + DOC "Kakadu kdu_expand program used in encoder non-regression testing") + IF(REF_DECODER_BIN) + GET_FILENAME_COMPONENT(REF_DECODER_BIN_PATH ${REF_DECODER_BIN} PATH CACHE) + MARK_AS_ADVANCED(REF_DECODER_BIN_PATH) + ENDIF(REF_DECODER_BIN) # Add repository where to find tests ADD_SUBDIRECTORY(tests) diff --git a/tests/nonregression/CMakeLists.txt b/tests/nonregression/CMakeLists.txt index ec100e42..fbadd615 100644 --- a/tests/nonregression/CMakeLists.txt +++ b/tests/nonregression/CMakeLists.txt @@ -17,11 +17,10 @@ CONFIGURE_FILE("opj_ref_decode_cmd.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/opj_ref_decode_cmd.sh" @ONLY) ENDIF (NOT WIN32) - -STRING(COMPARE EQUAL ${REF_DECODER_BIN_PATH} "NOTFOUND" REF_DECODER_NOTFOUND) -IF (REF_DECODER_NOTFOUND) - MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a regular path") -ENDIF (REF_DECODER_NOTFOUND) + +IF (NOT REF_DECODER_BIN_PATH) + MESSAGE(STATUS "REF_DECODER_BIN_PATH not set, if you want all the encoding tests suite provide the path to kdu_expand") +ENDIF (NOT REF_DECODER_BIN_PATH)