Files
mlpack/CMake/ModifyMatlabPathdef.cmake
T
Alexander Leinoff 2330419b86 Removes CMake block termination arguments
Previously CMake block termination commands were required to have arguments
matching the command starting the block. This is no longer necessary and not
the preferred style. This type of change has been implemented in other open
source projects such as: ITK, vxl, and BRAINSTools. It is the preferred style
for KDE. Consistent style practices help improve readability and
maintainability of code.

This was implemented with the shell script:
NOTE: MUST USE GNU compliant version of sed
in else endif endforeach endfunction endmacro endwhile; do
        echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
    done >convert.sed \
    && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' \
       | xargs -0 gsed -i -f convert.sed \
    && rm convert.sed

This is a reimplementation of ITK commit
e52dbe7fa476f6283c9b9d1507fca052355113a4

Fixes #585
2016-03-21 17:23:25 -05:00

26 lines
960 B
CMake

# Our goal is to make sure that the toolbox/mlpack directory is in the MATLAB
# default path. It is possible that that directory is already in the path, so
# we must consider that possibility too.
#
# This script assumes that ${MATLAB_ROOT} is set and writes the (potentially)
# modified file to ${PATHDEF_OUTPUT_FILE}.
# This could potentially be incorrect for older versions of MATLAB.
file(READ "${MATLAB_ROOT}/toolbox/local/pathdef.m" PATHDEF)
string(REGEX MATCH "matlabroot,'/toolbox/mlpack:',[ ]*..." MLPACK_PATHDEF
"${PATHDEF}")
if("${MLPACK_PATHDEF}" STREQUAL "")
# The MLPACK toolbox does not exist in the path. Therefore we have to modify
# the file.
string(REPLACE "%%% END ENTRIES %%%"
"matlabroot,'/toolbox/mlpack:', ...\n%%% END ENTRIES %%%" MOD_PATHDEF
"${PATHDEF}")
file(WRITE "${PATHDEF_OUTPUT_FILE}" "${MOD_PATHDEF}")
else()
# Write unmodified file.
file(WRITE "${PATHDEF_OUTPUT_FILE}" "${PATHDEF}")
endif()