Ticket #32528: patch-CMakeLists.txt.diff

File patch-CMakeLists.txt.diff, 3.1 KB (added by marin.saric@…, 13 years ago)
  • CMakeLists.txt

    old new  
    7474# ----------------------------------------------------------------------------
    7575set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)")
    7676
     77# Allow for building both dynamic and static libraries by running
     78# cmake multiple times
     79set(OPENCV_BUILT_SHARED_AND_STATIC OFF CACHE BOOL
     80  "OpenCV is built both shared and static by successive calls to cmake")
     81
     82# Link static libraries against other static libraries on MacOS, if possible
     83if(APPLE AND NOT BUILD_SHARED_LIBS)
     84    set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.framework;.dylib")
     85endif()
     86
    7787# ----------------------------------------------------------------------------
    7888# Include debug info into debug libs?
    7989# Default: yes
     
    439449macro(CHECK_MODULE module_name define)
    440450    set(${define} 0)
    441451    if(PKG_CONFIG_FOUND)
     452        if (BUILD_SHARED_LIBS)
     453            set(ALIAS_PKG_BUILD_MODE "")
     454        else()
     455            set(ALIAS_PKG_BUILD_MODE "_STATIC")
     456        endif()
    442457        set(ALIAS               ALIASOF_${module_name})
    443458        set(ALIAS_FOUND                 ${ALIAS}_FOUND)
    444459        set(ALIAS_INCLUDE_DIRS   ${ALIAS}_INCLUDE_DIRS)
    445         set(ALIAS_LIBRARY_DIRS   ${ALIAS}_LIBRARY_DIRS)
    446         set(ALIAS_LIBRARIES         ${ALIAS}_LIBRARIES)
     460        set(ALIAS_LIBRARY_DIRS   ${ALIAS}_${ALIAS_PKG_BUILD_MODE}_LIBRARY_DIRS)
     461        set(ALIAS_LIBRARIES         ${ALIAS}${ALIAS_PKG_BUILD_MODE}_LIBRARIES)
    447462
    448463        PKG_CHECK_MODULES(${ALIAS} ${module_name})
    449464
     
    461476                endif()
    462477            endforeach()
    463478
    464             list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})
     479            foreach(TMP_LIB_NAME ${${ALIAS_LIBRARIES}})
     480                FIND_LIBRARY(${TMP_LIB_NAME}_LIBRARY
     481                  NAMES ${TMP_LIB_NAME}
     482                  PATHS ${${ALIAS_LIBRARY_DIRS}})
     483                list(APPEND HIGHGUI_LIBRARIES ${${TMP_LIB_NAME}_LIBRARY})
     484            endforeach()
    465485        endif()
    466486    endif()
    467487endmacro()
     
    509529      CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
    510530      CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
    511531      CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
     532      CHECK_MODULE(orc-0.4 HAVE_ORC_04)
    512533      CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
    513534      CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
    514535      if(NOT HAVE_GENTOO_FFMPEG AND NOT HAVE_FFMPEG_FFMPEG)
     
    702723set(HAVE_SPHINX 0)
    703724if(SPHINX_PROCESS EQUAL 0)
    704725    find_host_program(SPHINX_BUILD sphinx-build)
     726    if (NOT SPHINX_BUILD)
     727      find_host_program(SPHINX_BUILD sphinx-build-${PYTHON_VERSION_MAJOR_MINOR})
     728    endif()
    705729    if(SPHINX_BUILD)
    706730        set(HAVE_SPHINX 1)
    707731        message(STATUS "    Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")
     
    15391563add_subdirectory(data)
    15401564add_subdirectory(3rdparty)
    15411565
    1542 if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
     1566if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES
     1567   OR INSTALL_C_EXAMPLES)
    15431568    add_subdirectory(samples)
    15441569endif()
    15451570