Skip to content

Commit

Permalink
Merge pull request #566 from ros/atomic_configure_file
Browse files Browse the repository at this point in the history
added atomic_configure_file function to catkin
  • Loading branch information
dirk-thomas committed Dec 23, 2013
2 parents f94e61b + 6c95dce commit 15dcaee
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions cmake/all.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ include(CMakeParseArguments)
# python-integration: catkin_python_setup.cmake, interrogate_setup_dot_py.py, templates/__init__.py.in, templates/script.py.in, templates/python_distutils_install.bat.in, templates/python_distutils_install.sh.in, templates/safe_execute_install.cmake.in
foreach(filename
assert
atomic_configure_file
catkin_add_env_hooks
catkin_destinations
catkin_generate_environment
Expand Down
5 changes: 5 additions & 0 deletions cmake/atomic_configure_file.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function(atomic_configure_file input output)
set(atomic_file "${CMAKE_BINARY_DIR}/atomic_configure_file")
configure_file("${input}" "${atomic_file}" ${ARGN})
file(RENAME "${atomic_file}" "${output}")
endfunction()
2 changes: 1 addition & 1 deletion cmake/catkin_add_env_hooks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function(catkin_add_env_hooks file_prefix)
else()
set(in_template ${base}.in)
endif()
configure_file(${in_template}
atomic_configure_file(${in_template}
${CATKIN_DEVEL_PREFIX}/etc/catkin/profile.d/${ENV_HOOK}
@ONLY)
elseif (EXISTS ${base})
Expand Down
12 changes: 6 additions & 6 deletions cmake/catkin_generate_environment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ function(catkin_generate_environment)
endif()

# generate Python setup util
configure_file(${catkin_EXTRAS_DIR}/templates/_setup_util.py.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/_setup_util.py.in
${CATKIN_DEVEL_PREFIX}/_setup_util.py
@ONLY)

if(NOT WIN32)
# non-windows
# generate env
configure_file(${catkin_EXTRAS_DIR}/templates/env.sh.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/env.sh.in
${CATKIN_DEVEL_PREFIX}/env.sh
@ONLY)
# generate setup for various shells
foreach(shell bash sh zsh)
configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in
${CATKIN_DEVEL_PREFIX}/setup.${shell}
@ONLY)
endforeach()

else()
# windows
# generate env
configure_file(${catkin_EXTRAS_DIR}/templates/env.bat.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/env.bat.in
${CATKIN_DEVEL_PREFIX}/env.bat
@ONLY)
# generate setup
configure_file(${catkin_EXTRAS_DIR}/templates/setup.bat.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/setup.bat.in
${CATKIN_DEVEL_PREFIX}/setup.bat
@ONLY)
endif()

# generate rosinstall file referencing setup.sh
configure_file(${catkin_EXTRAS_DIR}/templates/rosinstall.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/rosinstall.in
${CATKIN_DEVEL_PREFIX}/.rosinstall
@ONLY)

Expand Down
2 changes: 1 addition & 1 deletion cmake/catkin_python_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function(catkin_python_setup)
message(FATAL_ERROR "The script '${name}' as listed in 'setup.py' of '${PROJECT_NAME}' doesn't exist")
endif()
set(PYTHON_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/${script})
configure_file(${catkin_EXTRAS_DIR}/templates/script.py.in
atomic_configure_file(${catkin_EXTRAS_DIR}/templates/script.py.in
${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_BIN_DESTINATION}/${name}
@ONLY)
endforeach()
Expand Down

0 comments on commit 15dcaee

Please sign in to comment.