Repository: kudu Updated Branches: refs/heads/master 50274c8f8 -> 368f4f734
cmake: don't incorporate filenames in regexp patterns It leads to incorrect match failures when the filenames contain regexp metacharacters, the worst offender being '+'. I couldn't find a cmake equivalent to java.util.regex.Pattern's \Q and \E control characters, so I rewrote the matching logic with FIND and REPLACE instead. With this change, building from within a directory like kudu-1.2.0+cdh6.x+0/build/fastdebug correctly creates the 'latest' link. Change-Id: Iffbb9cb377625b537212e8244976ffc1b898840b Reviewed-on: http://gerrit.cloudera.org:8080/6161 Tested-by: Adar Dembo <[email protected]> Reviewed-by: Todd Lipcon <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/8f54f604 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/8f54f604 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/8f54f604 Branch: refs/heads/master Commit: 8f54f6049434196e80f3f4adeb450348a013bad4 Parents: 50274c8 Author: Adar Dembo <[email protected]> Authored: Sun Feb 26 19:29:21 2017 -0800 Committer: Todd Lipcon <[email protected]> Committed: Tue Feb 28 06:43:32 2017 +0000 ---------------------------------------------------------------------- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/8f54f604/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ec3917..84329a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,11 +45,15 @@ endif() # build/<first build directory> # build/<second build directory> # ... -if ("${CMAKE_CURRENT_BINARY_DIR}" MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}/build/[^/]+$") - if ("${CMAKE_CURRENT_BINARY_DIR}" MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}/build/latest") - message(FATAL_ERROR "Should not run cmake inside the build/latest symlink. " - "First change directories into the destination of the symlink.") - endif() +if ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL + "${CMAKE_CURRENT_SOURCE_DIR}/build/latest") + message(FATAL_ERROR "Should not run cmake inside the build/latest symlink. " + "First change directories into the destination of the symlink.") +endif() +string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/build/" "" + BLESSED_BUILD_SUBDIR "${CMAKE_CURRENT_BINARY_DIR}") +string(FIND "${BLESSED_BUILD_SUBDIR}" "/" SLASH_POS) +if (SLASH_POS EQUAL -1) if (NOT APPLE) set(MORE_ARGS "-T") endif()
