Warning, /office/calligra/cmake/modules/FindLibRCPS.cmake is written in an unsupported language. File is not indexed.

0001 # Find librcps
0002 # Input:
0003 #  LIBRCPS_MIN_VERSION The minimum version to look for
0004 # Result:
0005 #  LIBRCPS_FOUND - librcps with at least min version is found
0006 #  LIBRCPS_INCLUDE_DIR The include directory
0007 #  LIBRCPS_LIBRARIES The libraries needed to use librcps
0008 #  LIBRCPS_VERSION The actual version, may be higher than minimum
0009 
0010 message(STATUS "Running FindLibRCPS")
0011 
0012 if (WIN32)
0013   file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
0014 endif()
0015 
0016 if(NOT LIBRCPS_MIN_VERSION)
0017     set(LIBRCPS_MIN_VERSION "0.3")
0018 endif()
0019 
0020 if(LIBRCPS_INCLUDE_DIR AND LIBRCPS_LIBRARIES)
0021   # Already in cache, be silent
0022   set(LIBRCPS_FIND_QUIETLY TRUE)
0023 endif()
0024 
0025 find_path(LIBRCPS_INCLUDE_DIR librcps.h)
0026 find_library(LIBRCPS_LIBRARIES librcps.so)
0027 
0028 if(LIBRCPS_INCLUDE_DIR AND LIBRCPS_LIBRARIES)
0029   set(FIND_LIBRCPS_VERSION_SOURCE
0030     "#include <stdio.h>\n#include <librcps.h>\nint main()\n {\n printf(\"%s\",rcps_version());return 1;\n }\n")
0031   set(FIND_LIBRCPS_VERSION_SOURCE_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/FindLibRCPS.c)
0032   file(WRITE "${FIND_LIBRCPS_VERSION_SOURCE_FILE}" "${FIND_LIBRCPS_VERSION_SOURCE}")
0033 
0034   try_run(RUN_RESULT COMPILE_RESULT
0035     ${CMAKE_BINARY_DIR}
0036     ${FIND_LIBRCPS_VERSION_SOURCE_FILE}
0037     CMAKE_FLAGS
0038         -DINCLUDE_DIRECTORIES:STRING=${LIBRCPS_INCLUDE_DIR}
0039         -DLINK_LIBRARIES:STRING=${LIBRCPS_LIBRARIES}
0040     RUN_OUTPUT_VARIABLE LIBRCPS_VERSION)
0041 
0042   if(COMPILE_RESULT AND RUN_RESULT EQUAL 1)
0043     message(STATUS "Found librcps version ${LIBRCPS_VERSION}")
0044     macro_ensure_version(${LIBRCPS_MIN_VERSION} ${LIBRCPS_VERSION} LIBRCPS_VERSION_OK)
0045     if(LIBRCPS_VERSION_OK)
0046       set(LIBRCPS_FOUND TRUE)
0047     else()
0048       message(STATUS "Note: librcps version ${LIBRCPS_VERSION} is too old. At least version ${LIBRCPS_MIN_VERSION} is needed.")
0049       set(LIBRCPS_INCLUDE_DIR "")
0050       set(LIBRCPS_LIBRARIES "")
0051     endif()
0052   else()
0053     message(FATAL_ERROR "Unable to compile or run the librcps version detection program.")
0054   endif()
0055 
0056 endif()
0057 
0058 include(FindPackageHandleStandardArgs)
0059 find_package_handle_standard_args(LIBRCPS DEFAULT_MSG LIBRCPS_INCLUDE_DIR LIBRCPS_LIBRARIES)
0060 
0061 mark_as_advanced(LIBRCPS_INCLUDE_DIR LIBRCPS_LIBRARIES)