Warning, /pim/kdepim-addons/cmake/modules/kdepim_add_gpg_crypto_test.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2013 Sandro Knauß <mail@sandroknauss.de>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 set( GNUPGHOME ${CMAKE_BINARY_DIR}/plugins/pim6/messageviewer/bodypartformatter/autotests/gnupg_home )
0006 
0007 macro (ADD_GPG_CRYPTO_TEST _target _testname)
0008    if (UNIX)
0009       if (APPLE)
0010          set(_library_path_variable "DYLD_LIBRARY_PATH")
0011       elseif (CYGWIN)
0012          set(_library_path_variable "PATH")
0013       else (APPLE)
0014          set(_library_path_variable "LD_LIBRARY_PATH")
0015       endif (APPLE)
0016 
0017       if (APPLE)
0018          # DYLD_LIBRARY_PATH does not work like LD_LIBRARY_PATH
0019          # OSX already has the RPATH in libraries and executables, putting runtime directories in
0020          # DYLD_LIBRARY_PATH actually breaks things
0021          set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/")
0022       else (APPLE)
0023          set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${KDE_INSTALL_LIBDIR}:${QT_LIBRARY_DIR}")
0024       endif (APPLE)
0025       set(_executable "$<TARGET_FILE:${_target}>")
0026 
0027       # use add_custom_target() to have the sh-wrapper generated during build time instead of cmake time
0028       add_custom_command(TARGET ${_target} POST_BUILD
0029         COMMAND ${CMAKE_COMMAND}
0030         -D_filename=${_executable}.shell -D_library_path_variable=${_library_path_variable}
0031         -D_ld_library_path="${_ld_library_path}" -D_executable=$<TARGET_FILE:${_target}>
0032         -D_gnupghome="${GNUPGHOME}"
0033         -P ${CMAKE_SOURCE_DIR}/cmake/modules/kdepim_generate_crypto_test_wrapper.cmake
0034       )
0035 
0036       set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_executable}.shell" )
0037       add_test(NAME ${_testname} COMMAND ${_executable}.shell)
0038 
0039    else (UNIX)
0040       # under windows, set the property WRAPPER_SCRIPT just to the name of the executable
0041       # maybe later this will change to a generated batch file (for setting the PATH so that the Qt libs are found)
0042       set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}\;${KDE_INSTALL_LIBDIR}\;${QT_LIBRARY_DIR}")
0043       set(_executable "$<TARGET_FILE:${_target}>")
0044 
0045       # use add_custom_target() to have the batch-file-wrapper generated during build time instead of cmake time
0046       add_custom_command(TARGET ${_target} POST_BUILD
0047          COMMAND ${CMAKE_COMMAND}
0048          -D_filename="${_executable}.bat"
0049          -D_ld_library_path="${_ld_library_path}" -D_executable="${_executable}"
0050          -D_gnupghome="${GNUPGHOME}"
0051          -P ${CMAKE_SOURCE_DIR}/cmake/modules/kdepim_generate_crypto_test_wrapper.cmake
0052          )
0053 
0054       add_test(NAME ${_testname} COMMAND ${_executable}.bat)
0055 
0056    endif (UNIX)
0057 endmacro (ADD_GPG_CRYPTO_TEST)
0058