Skip to content

Commit

Permalink
Merge branch 'maxnbk-fix/whitespace-friendly-explicit-cmake-install-d…
Browse files Browse the repository at this point in the history
…irectives'
  • Loading branch information
nerdvegas committed Mar 19, 2022
2 parents 950ea29 + 60bfb3d commit f48ab32
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: apt-get update
run: |
sudo apt-get update
- name: Verify cmake
run: |
cmake --version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ rez_install_files(
DESTINATION include/translate
)

# install docs
FILE(GLOB_RECURSE doc_files "docs/*")
rez_install_files(
${doc_files}
RELATIVE src
DESTINATION docs
LOCAL_SYMLINK # Testing for github issue #553
)

# install cmake file
rez_install_cmake(
DESTINATION cmake
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file has spaces in its name
which is here so that cmake macros
get tested for handling spaces in filenames
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file very much does not
have a space in its name, as
a counterpart to the other
8 changes: 7 additions & 1 deletion src/rez/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ def _test_build_translate_lib(self):
self._test_build("translate_lib", "2.2.0")
context = self._create_context("translate_lib==2.2.0")
environ = context.get_environ()
find_file_in_path('translate_lib.cmake', environ['CMAKE_MODULE_PATH'])
root = environ['REZ_TRANSLATE_LIB_ROOT']
self.assertTrue(find_file_in_path('translate_lib.cmake', environ['CMAKE_MODULE_PATH']))
# is testing symlinks
self.assertTrue(find_file_in_path('an_unspaced_document', os.path.join(root, 'docs')))
# is testing spaces in symlinks per issue #553
self.assertTrue(find_file_in_path('a spaced document', os.path.join(root, 'docs')))

def _test_build_sup_world(self):
"""Build, install, test the sup_world package."""
Expand Down Expand Up @@ -156,6 +161,7 @@ def test_builds_anti(self):
self._test_build_anti()

@program_dependent("cmake")
@install_dependent()
def test_build_cmake(self):
"""Test a cmake-based package."""
if platform_.name == "windows":
Expand Down
10 changes: 5 additions & 5 deletions src/rezplugins/build_system/cmake_files/InstallFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ macro (install_files_)
# install files
#
foreach(f ${INSTF_DEFAULT_ARGS})
get_target_filepath(${f} ${rel_dir} ${dest_dir} target_fpath)
get_filename_component(target_path ${target_fpath} PATH)
get_target_filepath("${f}" "${rel_dir}" "${dest_dir}" target_fpath)
get_filename_component(target_path "${target_fpath}" PATH)
if(REZ_BUILD_TYPE STREQUAL "central" OR NOT INSTF_LOCAL_SYMLINK)
install(FILES ${f} DESTINATION ${target_path} PERMISSIONS ${perms})
install(FILES "${f}" DESTINATION "${target_path}" PERMISSIONS ${perms})
else()
install( CODE "message (STATUS \"Symlink : ${CMAKE_INSTALL_PREFIX}/${target_fpath} -> ${f}\" )" )
install( CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/${target_path})" )
install( CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${f} ${CMAKE_INSTALL_PREFIX}/${target_fpath})" )
install( CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory \"${CMAKE_INSTALL_PREFIX}/${target_path}\")" )
install( CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \"${f}\" \"${CMAKE_INSTALL_PREFIX}/${target_fpath}\")" )
endif(REZ_BUILD_TYPE STREQUAL "central" OR NOT INSTF_LOCAL_SYMLINK)

endforeach(f ${INSTF_DEFAULT_ARGS})
Expand Down

0 comments on commit f48ab32

Please sign in to comment.