Skip to content

Commit

Permalink
add PXR_SYMLINK_HEADER_FILES cmake option
Browse files Browse the repository at this point in the history
  • Loading branch information
pmolodo committed Feb 3, 2017
1 parent 0dc1c62 commit acf470c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions cmake/defaults/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ option(PXR_BUILD_MAYA_PLUGIN "Build usd maya plugin" OFF)
option(PXR_BUILD_ALEMBIC_PLUGIN "Build the Alembic plugin for USD" OFF)
option(PXR_MAYA_TBB_BUG_WORKAROUND "Turn on linker flag (-Wl,-Bsymbolic) to work around a Maya TBB bug" OFF)
option(PXR_ENABLE_NAMESPACES "Enable C++ namespaces." OFF)
option(PXR_SYMLINK_HEADER_FILES "Symlink the header files from, ie, pxr/base/lib/tf to CMAKE_DIR/pxr/base/tf, instead of copying; ensures that you may edit the header file in either location, and improves experience in IDEs which find normally the \"copied\" header, ie, CLion; has no effect on windows" OFF)

set(PXR_INSTALL_LOCATION ""
CACHE
Expand Down
31 changes: 23 additions & 8 deletions cmake/macros/Private.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,29 @@ function(_install_headers LIBRARY_NAME)
set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
set(outfile "${header_dest_dir}/${f}")
list(APPEND files_copied ${outfile})
add_custom_command(
OUTPUT ${outfile}
COMMAND "${CMAKE_COMMAND}"
ARGS -E copy "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
COMMENT "Copying ${f} ..."
VERBATIM
)
if(PXR_SYMLINK_HEADER_FILES AND NOT WIN32)
# cmake -E create_symlink doesn't create parent directories, while
# copy does... so need an extra command to make dir
add_custom_command(
OUTPUT ${outfile}
COMMAND "${CMAKE_COMMAND}"
ARGS -E make_directory "${header_dest_dir}"
COMMAND "${CMAKE_COMMAND}"
ARGS -E create_symlink "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
COMMENT "Symlinking ${f} ..."
VERBATIM
)
else()
add_custom_command(
OUTPUT ${outfile}
COMMAND "${CMAKE_COMMAND}"
ARGS -E copy "${infile}" "${outfile}"
MAIN_DEPENDENCY "${infile}"
COMMENT "Copying ${f} ..."
VERBATIM
)
endif()
endforeach()
endif()
endfunction() # _install_headers
Expand Down

0 comments on commit acf470c

Please sign in to comment.