Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2872536d78
Fetching contributors…

Cannot retrieve contributors at this time

134 lines (108 sloc) 4.973 kb
set(CMAKE_CONFIGURATION_TYPES "@CMAKE_CONFIGURATION_TYPES@")
set(CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
set(CMAKE_EXECUTABLE_SUFFIX "@CMAKE_EXECUTABLE_SUFFIX@")
set(launcher_name "@LAUNCHER_NAME@")
set(launcher_version "@LAUNCHER_VERSION@")
set(launcher_binary_dir "@LAUNCHER_BINARY_DIR@")
set(app4test_binary_dir "@APP4TEST_BINARY_DIR@")
set(app4test_build_type "@APP4TEST_BUILD_TYPE@")
if(WIN32)
set(pathsep ";")
set(library_path_variable_name "PATH")
elseif(APPLE)
set(pathsep ":")
set(library_path_variable_name "DYLD_LIBRARY_PATH")
elseif(UNIX)
set(pathsep ":")
set(library_path_variable_name "LD_LIBRARY_PATH")
endif()
# --------------------------------------------------------------------------
# Sanity checks
if(NOT EXISTS ${launcher_binary_dir})
message(FATAL_ERROR "Make sure variable CTKAppLauncher_BINARY_DIR is set to a valid directory. "
"CTKAppLauncher_BINARY_DIR [${launcher_binary_dir}]")
endif()
if(NOT EXISTS ${app4test_binary_dir})
message(FATAL_ERROR "Make sure variable APP4TEST_BINARY_DIR is set to a valid directory. "
"APP4TEST_BINARY_DIR [${app4test_binary_dir}]")
endif()
# --------------------------------------------------------------------------
# Attempt to guess launcher build type
set(launcher_dir ${launcher_binary_dir}/bin)
set(launcher_build_type "@CMAKE_BUILD_TYPE@")
if(WIN32)
foreach (type ${CMAKE_CONFIGURATION_TYPES})
if(EXISTS ${launcher_dir}/${type}/${launcher_name}${CMAKE_EXECUTABLE_SUFFIX})
set(launcher_build_type ${type})
endif()
endforeach()
endif()
if(${app4test_build_type} STREQUAL "")
message(FATAL_ERROR "'app4test_build_type' shouldn't be empty !")
endif()
# --------------------------------------------------------------------------
# Set launcher variable
if(WIN32)
set(launcher_dir ${launcher_dir}/${launcher_build_type})
endif()
set(launcher ${launcher_dir}/${launcher_name})
set(launcher_exe ${launcher}${CMAKE_EXECUTABLE_SUFFIX})
# --------------------------------------------------------------------------
# Check if launcher exists
if (NOT EXISTS ${launcher_exe})
message(FATAL_ERROR "Application ${launcher_exe} doesn't exists !")
endif()
# --------------------------------------------------------------------------
# Remove settings file if any
execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${launcher}LauncherSettings.ini)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${launcher}AdditionalLauncherSettings.ini)
# --------------------------------------------------------------------------
# Set application variable
set(application_dir "${app4test_binary_dir}/bin")
if(WIN32)
set(application_dir ${application_dir}/${app4test_build_type})
endif()
set(application_name App4Test)
set(application ${application_dir}/${application_name}${CMAKE_EXECUTABLE_SUFFIX})
# --------------------------------------------------------------------------
# Check if application exists
if (NOT EXISTS ${application})
message(FATAL_ERROR "Application ${application} doesn't exists !")
endif()
# --------------------------------------------------------------------------
# Sanity check
set(library_path ${app4test_binary_dir}/libs)
if(WIN32)
set(library_path ${library_path}/${app4test_build_type})
endif()
if (NOT EXISTS ${library_path})
message(FATAL_ERROR "Library path [${library_path}] doesn't exist")
endif()
# --------------------------------------------------------------------------
# Helper macro
FUNCTION(print_command_as_string command)
if(PRINT_COMMAND)
set(command_as_string)
foreach(elem ${command})
set(command_as_string "${command_as_string} ${elem}")
endforeach()
message(STATUS "COMMAND:${command_as_string}")
endif()
ENDFUNCTION()
# --------------------------------------------------------------------------
set(expected_help_text "
Usage
CTKAppLauncher [options]
Options
--launcher-help Display help
--launcher-version Show launcher version information
--launcher-verbose Verbose mode
--launch Specify the application to launch
--launcher-detach Launcher will NOT wait for the application to finish
--launcher-no-splash Hide launcher splash
--launcher-timeout Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)
--launcher-dump-environment Launcher will print environment variables to be set, then exit
--launcher-additional-settings Additional settings file to consider
--launcher-ignore-user-additional-settings Ignore additional user settings
--launcher-generate-exec-wrapper-script Generate executable wrapper script allowing to set the environment
--launcher-generate-template Generate an example of setting file")
Jump to Line
Something went wrong with that request. Please try again.