[trunk] search for kdu_expand in a more cmake-compliant way
authorJulien Malik <julien.malik@paraiso.me>
Sun, 27 Nov 2011 22:27:50 +0000 (22:27 +0000)
committerJulien Malik <julien.malik@paraiso.me>
Sun, 27 Nov 2011 22:27:50 +0000 (22:27 +0000)
CMakeLists.txt
tests/nonregression/CMakeLists.txt

index b23f2160551e4b647b00e47b99f62248d2e46184..3145fc13693f3b852642c00c60e2a207d647ffb0 100644 (file)
@@ -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)
index ec100e427d78399458cbfe7ebefe5bced2f30ff2..fbadd615709826a35cf94453afa0107cb0de2756 100644 (file)
@@ -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)