Modified cmake status report
authorAndrey Kamaev <no@email>
Fri, 1 Jul 2011 12:23:03 +0000 (12:23 +0000)
committerAndrey Kamaev <no@email>
Fri, 1 Jul 2011 12:23:03 +0000 (12:23 +0000)
CMakeLists.txt

index e55190d..0563a95 100644 (file)
@@ -1443,194 +1443,194 @@ endif()
 # ----------------------------------------------------------------------------
 #   Summary:
 # ----------------------------------------------------------------------------
-message(STATUS "")
-message(STATUS "General configuration for opencv ${OPENCV_VERSION} =====================================")
-message(STATUS "")
-message(STATUS "    Built as dynamic libs?:     ${BUILD_SHARED_LIBS}")
-message(STATUS "    Compiler:                   ${CMAKE_COMPILER}")
-message(STATUS "    C++ flags (Release):        ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
-message(STATUS "    C++ flags (Debug):          ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+macro(status text)
+    SET(status_cond)
+    SET(status_then)
+    SET(status_else)
+    
+    SET(status_current_name "cond")
+    foreach(arg ${ARGN})
+       if(arg STREQUAL "THEN")
+           SET(status_current_name "then")
+       elseif(arg STREQUAL "ELSE")
+           SET(status_current_name "else")
+       else()
+           LIST(APPEND status_${status_current_name} ${arg})
+       endif()
+    endforeach()
+
+    if(DEFINED status_cond)
+        SET(status_placeholder_length 32)
+        string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)
+        string(LENGTH "${text}" status_text_length)
+        if (status_text_length LESS status_placeholder_length)
+            string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)
+        elseif (status_then OR status_else)
+            message(STATUS "${text}")
+            SET(status_text "${status_placeholder}")
+        else()
+            SET(status_text "${text}")
+        endif()
+
+        if (status_then OR status_else)
+            if(${status_cond})
+                string(REPLACE ";" " " status_then "${status_then}")
+                message(STATUS "${status_text}" "${status_then}")
+            else()
+                string(REPLACE ";" " " status_else "${status_else}")
+                message(STATUS "${status_text}" "${status_else}")
+            endif()
+        else()
+            string(REPLACE ";" " " status_cond "${status_cond}")
+            message(STATUS "${status_text}" "${status_cond}")
+        endif()
+     else()
+         message(STATUS "${text}")
+     endif()
+endmacro()
+
+status("")
+status("General configuration for opencv ${OPENCV_VERSION} =====================================")
+status("")
+status("    Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
+status("    Compiler:"               CMAKE_COMPILER THEN "${CMAKE_COMPILER}" ELSE "${CMAKE_CXX_COMPILER}")
+status("    C++ flags (Release):"    ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
+status("    C++ flags (Debug):"      ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
 if(WIN32)
-message(STATUS "    Linker flags (Release):     ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
-message(STATUS "    Linker flags (Debug):       ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+    status("    Linker flags (Release):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
+    status("    Linker flags (Debug):"   ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
 else()
-message(STATUS "    Linker flags (Release):     ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
-message(STATUS "    Linker flags (Debug):       ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+    status("    Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
+    status("    Linker flags (Debug):"   ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
 endif()
 
 #YV
-message(STATUS "")
-message(STATUS "  GUI: ")
+status("")
+status("  GUI: ")
 
 if (HAVE_QT)
-    message(STATUS "    QT 4.x:                     ${HAVE_QT}")
-    message(STATUS "    QT OpenGL support:          ${HAVE_QT_OPENGL}")
+    status("    QT 4.x:"            HAVE_QT        THEN YES ELSE NO)
+    status("    QT OpenGL support:" HAVE_QT_OPENGL THEN YES ELSE NO)
 else()
     if(WIN32)
-        message(STATUS "    Win32 UI:                   YES")
+        status("    Win32 UI:" YES)
     else()
         if(APPLE)
             if(WITH_CARBON)
-                message(STATUS "    Carbon:                     YES")
+                status("    Carbon:" YES)
             else()
-                message(STATUS "    Cocoa:                      YES")
+                status("    Cocoa:"  YES)
             endif()
         else()
-            message(STATUS "    GTK+ 2.x:                   ${HAVE_GTK}")
-            message(STATUS "    GThread:                    ${HAVE_GTHREAD}")
+            status("    GTK+ 2.x:" HAVE_GTK     THEN YES ELSE NO)
+            status("    GThread:"  HAVE_GTHREAD THEN YES ELSE NO)
         endif()
     endif()
 endif()
 
-message(STATUS "")
-message(STATUS "  Media I/O: ")
-if(ZLIB_FOUND)
-message(STATUS "    ZLib:                       ${ZLIB_FOUND}")
-else()
-message(STATUS "    ZLib:                       build")
-endif()
+# media
+status("")
+status("  Media I/O: ")
+status("    ZLib:"      ZLIB_FOUND                         THEN YES             ELSE build)
+status("    JPEG:"      NOT WITH_JPEG OR JPEG_FOUND        THEN ${JPEG_FOUND}   ELSE build)
+status("    PNG:"       NOT WITH_PNG OR PNG_FOUND          THEN ${PNG_FOUND}    ELSE build)
+status("    TIFF:"      NOT WITH_TIFF OR TIFF_FOUND        THEN ${TIFF_FOUND}   ELSE build)
+status("    JPEG 2000:" NOT WITH_JASPER OR JASPER_FOUND    THEN ${JASPER_FOUND} ELSE build)
+status("    OpenEXR:"   NOT WITH_OPENEXRR OR OPENEXR_FOUND THEN YES             ELSE NO)
 
-if(NOT WITH_JPEG OR JPEG_FOUND)
-message(STATUS "    JPEG:                       ${JPEG_FOUND}")
-else()
-message(STATUS "    JPEG:                       build")
-endif()
+status("    OpenNI:"    NOT HAVE_OPENNI OR HAVE_OPENNI_PRIME_SENSOR_MODULE
+                            THEN NO
+                            ELSE "${HAVE_OPENNI} (WARNING: PrimeSensor Modules for OpenNI are not installed (not found in OPENNI_PRIME_SENSOR_MODULE_BIN_DIR).)")
 
-if(NOT WITH_PNG OR PNG_FOUND)
-message(STATUS "    PNG:                        ${PNG_FOUND}")
-else()
-message(STATUS "    PNG:                        build")
-endif()
-
-if(NOT WITH_TIFF OR TIFF_FOUND)
-message(STATUS "    TIFF:                       ${TIFF_FOUND}")
-else()
-message(STATUS "    TIFF:                       build")
-endif()
-
-if(NOT WITH_JASPER OR JASPER_FOUND)
-message(STATUS "    JPEG 2000:                  ${JASPER_FOUND}")
-else()
-message(STATUS "    JPEG 2000:                  build")
-endif()
+# video
+status("")
+if(UNIX AND NOT APPLE)
+    status("  Video I/O:")
+    status("    DC1394 1.x:"     HAVE_DC1394         THEN YES ELSE NO)
+    status("    DC1394 2.x:"     HAVE_DC1394_2       THEN YES ELSE NO)
+    status("    FFMPEG:"         HAVE_FFMPEG         THEN YES ELSE NO)
+    status("      codec:"        HAVE_FFMPEG_CODEC   THEN YES ELSE NO)
+    status("      format:"       HAVE_FFMPEG_FORMAT  THEN YES ELSE NO)
+    status("      util:"         HAVE_FFMPEG_UTIL    THEN YES ELSE NO)
+    status("      swscale:"      HAVE_FFMPEG_SWSCALE THEN YES ELSE NO)
+    status("      gentoo-style:" HAVE_GENTOO_FFMPEG  THEN YES ELSE NO)
+    status("    GStreamer:"      HAVE_GSTREAMER      THEN YES ELSE NO)
+    status("    UniCap:"         HAVE_UNICAP         THEN YES ELSE NO)
+    status("    PvAPI:"          HAVE_PVAPI          THEN YES ELSE NO)
+    status("    V4L/V4L2:"       HAVE_LIBV4L         THEN Using libv4l ELSE ${HAVE_CAMV4L}/${HAVE_CAMV4L2})
+    status("    Xine:"           HAVE_XINE           THEN YES ELSE NO)
 
-if(WITH_OPENEXR AND OPENEXR_FOUND)
-message(STATUS "    OpenEXR:                    YES")
-else()
-message(STATUS "    OpenEXR:                    NO")
+    if(ANDROID)
+        if(BUILD_ANDROID_CAMERA_WRAPPER)
+            status("    AndroidNativeCamera:" "build for Android ${ANDROID_VERSION}")
+        else()
+            status("    AndroidNativeCamera:" ARMEABI_V7A THEN use prebuilt libraries ELSE NO)
+        endif()
+    endif()
+elseif(APPLE)
+    status("  Video I/O:"        WITH_QUICKTIME      THEN QuickTime ELSE QTKit)
+elseif(WIN32)
+    status("  Video I/O:"        HAVE_VIDEOINPUT     THEN DirectShow ELSE NO)
 endif()
 
-if(NOT HAVE_OPENNI OR HAVE_OPENNI_PRIME_SENSOR_MODULE)
-message(STATUS "    OpenNI:                     ${HAVE_OPENNI}")
-else()
-message(STATUS "    OpenNI:                     ${HAVE_OPENNI} (WARNING: PrimeSensor Modules for OpenNI are not installed (not found in OPENNI_PRIME_SENSOR_MODULE_BIN_DIR).)")
-endif()
+# interfaces to other languages
+status("")
+status("  Interfaces:")
+status("    Python:"              BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO)
+status("    Python interpreter:"  PYTHON_EXECUTABLE        THEN "${PYTHON_EXECUTABLE}" ELSE NO)
+status("    Python numpy:"        PYTHON_USE_NUMPY         THEN YES ELSE "NO (Python interface will not cover OpenCV 2.x API)")
+status("    Java:"                BUILD_JAVA_SUPPORT       THEN YES ELSE NO)
 
-if(UNIX AND NOT APPLE)
-message(STATUS "")
-message(STATUS "  Video I/O: ")
-message(STATUS "    DC1394 1.x:                 ${HAVE_DC1394}")
-message(STATUS "    DC1394 2.x:                 ${HAVE_DC1394_2}")
-message(STATUS "    FFMPEG:                     ${HAVE_FFMPEG}")
-message(STATUS "      codec:                    ${HAVE_FFMPEG_CODEC}")
-message(STATUS "      format:                   ${HAVE_FFMPEG_FORMAT}")
-message(STATUS "      util:                     ${HAVE_FFMPEG_UTIL}")
-message(STATUS "      swscale:                  ${HAVE_FFMPEG_SWSCALE}")
-message(STATUS "      gentoo-style:             ${HAVE_GENTOO_FFMPEG}")
-message(STATUS "    GStreamer:                  ${HAVE_GSTREAMER}")
-message(STATUS "    UniCap:                     ${HAVE_UNICAP}")
-message(STATUS "    PvAPI:                      ${HAVE_PVAPI}")
-if(HAVE_LIBV4L)
-message(STATUS "    V4L/V4L2:                   Using libv4l")
-else()
-message(STATUS "    V4L/V4L2:                   ${HAVE_CAMV4L}/${HAVE_CAMV4L2}")
-endif()
-message(STATUS "    Xine:                       ${HAVE_XINE}")
 if(ANDROID)
-if (ARMEABI_V7A)
-if(BUILD_ANDROID_CAMERA_WRAPPER)
-message(STATUS "    AndroidNativeCamera:        build for Android ${ANDROID_VERSION}")
-else()
-message(STATUS "    AndroidNativeCamera:        use prebuilt libraries")
-endif(BUILD_ANDROID_CAMERA_WRAPPER)
-else(ARMEABI_V7A)
-message(STATUS "    AndroidNativeCamera:        NO")
-endif(ARMEABI_V7A)
-endif(ANDROID)
-endif(UNIX AND NOT APPLE)
-
-if(APPLE)
-message(STATUS "")
-if(WITH_QUICKTIME)
-message(STATUS "  Video I/O:                    QuickTime")
-else()
-message(STATUS "  Video I/O:                    QTKit")
-endif()
-endif(APPLE)
-
-if(WIN32 AND HAVE_VIDEOINPUT)
-message(STATUS "")
-message(STATUS "  Video I/O:                    DirectShow")
+    status("    android tool:"    ANDROID_EXECUTABLE       THEN "${ANDROID_EXECUTABLE}" ELSE NO)
+    status("    ant:"             ANT_EXECUTABLE           THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
 endif()
 
-message(STATUS "")
-message(STATUS "  Interfaces: ")
-message(STATUS "    Python:                     ${BUILD_NEW_PYTHON_SUPPORT}")
-message(STATUS "    Python interpreter:         ${PYTHON_EXECUTABLE}")
-if (PYTHON_USE_NUMPY)
-message(STATUS "    Python numpy:               YES")
-else()
-message(STATUS "    Python numpy:               NO (Python interface will not cover OpenCV 2.x API)")
-endif()
-message(STATUS "    Java:                       ${BUILD_JAVA_SUPPORT}")
+# Other third-party libraries
+status("")
+status("  Other third-party dependencies:")
 
 if(WITH_IPP AND IPP_FOUND)
-message(STATUS "    Use IPP:                    ${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")
-message(STATUS "         at:                    ${IPP_ROOT_DIR}")
-elseif(WITH_IPP AND NOT IPP_FOUND)
-message(STATUS "    Use IPP:                    IPP not found")
+    status("    Use IPP:" "${IPP_LATEST_VERSION_STR} [${IPP_LATEST_VERSION_MAJOR}.${IPP_LATEST_VERSION_MINOR}.${IPP_LATEST_VERSION_BUILD}]")
+    status("         at:" "${IPP_ROOT_DIR}")
 else()
-message(STATUS "    Use IPP:                    NO")
+    status("    Use IPP:"   WITH_IPP AND NOT IPP_FOUND THEN IPP not found ELSE NO)
 endif()
 
-if(HAVE_TBB)
-message(STATUS "    Use TBB:                    YES")
-else()
-message(STATUS "    Use TBB:                    NO")
-if(HAVE_THREADING_FRAMEWORK)
-message(STATUS "    Use ThreadingFramework:     YES")
-else()
-message(STATUS "    Use ThreadingFramework:     NO")
-endif()
-endif()
+status("    Use TBB:" HAVE_TBB THEN YES ELSE NO)
 
-if (HAVE_CUDA)
-message(STATUS "    Use Cuda:                   YES")
-else()
-message(STATUS "    Use Cuda:                   NO")
+if(UNIX)
+    status("    Use ThreadingFramework:" HAVE_THREADING_FRAMEWORK THEN YES ELSE NO)
 endif()
 
-if(HAVE_EIGEN)
-message(STATUS "    Use Eigen:                  YES")
-else()
-message(STATUS "    Use Eigen:                  NO")
-endif()
+status("    Use Cuda:"  HAVE_CUDA  THEN YES ELSE NO)
+status("    Use Eigen:" HAVE_EIGEN THEN YES ELSE NO)
 
-message(STATUS "")
-message(STATUS "  Documentation: ")
+# documentation
+status("")
+status("  Documentation:")
+status("    Sphinx:"              HAVE_SPHINX                                      THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
+status("    PdfLaTeX compiler:"   BUILD_DOCS AND PDFLATEX_COMPILER                 THEN "${PDFLATEX_COMPILER}" ELSE NO)
+status("    Build Documentation:" BUILD_DOCS AND PDFLATEX_COMPILER AND HAVE_SPHINX THEN YES ELSE NO)
 
-if(BUILD_DOCS AND PDFLATEX_COMPILER AND HAVE_SPHINX)
-message(STATUS "    Build Documentation:        YES")
-else()
-message(STATUS "    Build Documentation:        NO")
+# samples and tests
+status("")
+status("  Tests and samples:")
+status("    Tests:"    BUILD_TESTS     THEN YES ELSE NO)
+status("    Examples:" BUILD_EXAMPLES  THEN YES ELSE NO)
+
+if(ANDROID)
+   status("    Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO)
+   status("    Android examples:" BUILD_EXAMPLES AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO)
 endif()
 
-message(STATUS "")
-message(STATUS "    Install path:               ${CMAKE_INSTALL_PREFIX}")
-message(STATUS "")
-message(STATUS "    cvconfig.h is in:           ${OPENCV_CONFIG_FILE_INCLUDE_DIR}")
-message(STATUS "-----------------------------------------------------------------")
-message(STATUS "")
+# auxiliary
+status("")
+status("  Install path:" "${CMAKE_INSTALL_PREFIX}")
+status("")
+status("  cvconfig.h is in:" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}")
+status("-----------------------------------------------------------------")
+status("")
 
 # warn in the case of in-source build
 if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")