D10011: make cmake/FindLibIcal.cmake ready for cross compilation.

Sandro Knauß noreply at phabricator.kde.org
Tue Jan 23 10:08:25 GMT 2018


knauss added a comment.


  @cgiboudeaux: did you checked on Windows? Is the whole WIN32 block is still needed, or can it removed completly?

INLINE COMMENTS

> cgiboudeaux wrote in FindLibIcal.cmake:4
> Please change it back to LibIcal_INCLUDE_DIRS. We're following the CMake policies and coding style recommendations
> 
> Xxx_INCLUDE_DIRS
> 
>   The final set of include directories listed in one variable for use by client code. This should not be a cache entry.

mmh i changed it because pkgconfig returns XXX_INCLUDEDIR and I thought so this is the more "stadardized" name.

> cgiboudeaux wrote in FindLibIcal.cmake:18-20
> use the QUIET keyword for both lines

for the first I can understand, beause we don't want PkgConfig found line shown.
But why QUIT for the second line?

> FindLibIcal.cmake:23
>  
> -find_path(LibIcal_INCLUDE_DIRS
> -  NAMES libical/ical.h
> -  HINTS ${libical_root}/include ${_program_FILES_DIR}/libical/include
> -)
> -
> -find_library(LibIcal_LIBRARY
> -  NAMES ical libical
> -  HINTS
> -    ${libical_root}/lib64 ${_program_FILES_DIR}/libical/lib64
> -    ${libical_root}/lib ${_program_FILES_DIR}/libical/lib
> -)
> -
> -find_library(LibIcalss_LIBRARY
> -  NAMES icalss libicalss
> -  HINTS
> -    ${libical_root}/lib64 ${_program_FILES_DIR}/libical/lib64
> -    ${libical_root}/lib ${_program_FILES_DIR}/libical/lib
> -)
> -
> -set(LibIcal_LIBRARIES ${LibIcal_LIBRARY} ${LibIcalss_LIBRARY})
> -
> -if(LibIcal_INCLUDE_DIRS AND LibIcal_LIBRARIES)
> -  set(FIND_LibIcal_VERSION_SOURCE
> -    "#include <libical/ical.h>\n int main()\n {\n printf(\"%s\",ICAL_VERSION);return 1;\n }\n"
> -  )
> -  set(FIND_LibIcal_VERSION_SOURCE_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/FindLIBICAL.cxx)
> -  file(WRITE "${FIND_LibIcal_VERSION_SOURCE_FILE}" "${FIND_LibIcal_VERSION_SOURCE}")
> -
> -  set(FIND_LibIcal_VERSION_ADD_INCLUDES
> -    "-DINCLUDE_DIRECTORIES:STRING=${LibIcal_INCLUDE_DIRS}")
> -
> -  if(NOT CMAKE_CROSSCOMPILING)
> -  try_run(RUN_RESULT COMPILE_RESULT
> -    ${CMAKE_BINARY_DIR}
> -    ${FIND_LibIcal_VERSION_SOURCE_FILE}
> -    CMAKE_FLAGS "${FIND_LibIcal_VERSION_ADD_INCLUDES}"
> -    COMPILE_OUTPUT_VARIABLE FIND_LibIcal_Compile_Output
> -    RUN_OUTPUT_VARIABLE LibIcal_VERSION)
> -  endif()
> -
> -  if(COMPILE_RESULT AND RUN_RESULT EQUAL 1 AND NOT CMAKE_CROSSCOMPILING)
> -    message(STATUS "Found Libical version ${LibIcal_VERSION}")
> -    if(${LibIcal_VERSION} VERSION_LESS ${LibIcal_FIND_VERSION})
> -      message(STATUS "LibIcal version ${LibIcal_VERSION} is too old. At least version ${LibIcal_FIND_VERSION} is needed.")
> -      set(LibIcal_INCLUDE_DIRS "")
> -      set(LibIcal_LIBRARIES "")
> -    endif()
> -    if(NOT LibIcal_VERSION VERSION_LESS 0.46)
> -      set(USE_ICAL_0_46 TRUE)
> -    endif()
> -    if(NOT LibIcal_VERSION VERSION_LESS 1.00)
> -      set(USE_ICAL_1_0 TRUE)
> -    endif()
> -
> -  else()
> -    if(NOT CMAKE_CROSSCOMPILING)
> -      if(NOT COMPILE_RESULT)
> -        message(FATAL_ERROR "Unable to compile the libical version detection program: ${FIND_LibIcal_Compile_Output}")
> -      else()
> -        message(FATAL_ERROR "Unable to run the libical version detection program: it returned ${RUN_RESULT}.")
> -      endif()
> -    endif()
> -  endif()
> -
> -  #compute the major and minor version numbers
> -  if(NOT CMAKE_CROSSCOMPILING)
> -    string(REGEX REPLACE "\\..*$" "" LibIcal_MAJOR_VERSION ${LibIcal_VERSION})
> -    string(REGEX REPLACE "^.*\\." "" LibIcal_MINOR_VERSION ${LibIcal_VERSION})
> -  endif()
> -
> -endif()
> +if(WIN32)
> +   file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)

if we don't if/endif the pkgconfig call, we can modify to 
if(NOT LibIcal_FOUND)

REPOSITORY
  R172 KCalendar Core

REVISION DETAIL
  https://phabricator.kde.org/D10011

To: knauss, #kde_pim, winterz
Cc: cgiboudeaux, dvasin, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20180123/eb1ea76c/attachment.html>


More information about the kde-pim mailing list