Warning, /pim/sink/cmake/modules/add_gpg_crypto_test.cmake is written in an unsupported language. File is not indexed.

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