Skip to content

Commit

Permalink
Adds 'wrappers' target, installs wrapper scripts
Browse files Browse the repository at this point in the history
This target, run by default, installs wrapper scripts "uvcdat", "cdat"
and "loadcdat" into WRAPPER_INSTALL_LOCATION (by default
install/wrappers). These scripts setup the environment, so they are safe
to be brought in the user's PATH; they won't conflict or break the
environment.

This should really be "make install" but that target is broken by our
CPack setup.
  • Loading branch information
remram44 committed Jan 30, 2015
1 parent b0d5230 commit 4b03f91
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMake/cdat_modules_extra/cdat.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# source is not portable whereas . is
. "@CMAKE_INSTALL_PREFIX@/bin/setup_runtime.sh"
python@PYVER@ "$@"
37 changes: 37 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,11 @@ configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/uvcdat.in
@ONLY
)

configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/cdat.in
${CMAKE_INSTALL_PREFIX}/bin/cdat
@ONLY
)


if (BUILD_TESTING)
configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/runpytest.in
Expand All @@ -707,6 +712,38 @@ if (BUILD_TESTING)
add_subdirectory(testing)
endif()

# Where to install the wrapper scripts
set(WRAPPER_INSTALL_LOCATION ${CMAKE_INSTALL_PREFIX}/wrappers
CACHE PATH
"Install wrapper scripts 'cdat', 'uvcdat' and 'loadcdat' in that directory")

add_custom_command(
OUTPUT ${WRAPPER_INSTALL_LOCATION}/loadcdat
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/bin/setup_runtime.sh
${WRAPPER_INSTALL_LOCATION}/loadcdat)
add_custom_command(
OUTPUT ${WRAPPER_INSTALL_LOCATION}/loadcdat.csh
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/bin/setup_runtime.csh
${WRAPPER_INSTALL_LOCATION}/loadcdat.csh)
add_custom_command(
OUTPUT ${WRAPPER_INSTALL_LOCATION}/uvcdat
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/bin/uvcdat
${WRAPPER_INSTALL_LOCATION}/uvcdat)
add_custom_command(
OUTPUT ${WRAPPER_INSTALL_LOCATION}/cdat
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_INSTALL_PREFIX}/bin/cdat
${WRAPPER_INSTALL_LOCATION}/cdat)

add_custom_target(wrappers ALL DEPENDS
${WRAPPER_INSTALL_LOCATION}/loadcdat
${WRAPPER_INSTALL_LOCATION}/loadcdat.csh
${WRAPPER_INSTALL_LOCATION}/uvcdat
${WRAPPER_INSTALL_LOCATION}/cdat)

# Package UV-CDAT with CPACK
include(InstallRequiredSystemLibraries)

Expand Down

0 comments on commit 4b03f91

Please sign in to comment.