kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/2] incubator-kudu git commit: cmake: ensure build/latest/ is re-symlinked on every binary build
Date Fri, 29 Jan 2016 22:28:18 GMT
cmake: ensure build/latest/ is re-symlinked on every binary build

My typical workflow is to just build and run individual tests, rather
than building the entire project. This adds some cmake hackery so that
when any executable is built, it will ensure that the build/latest/
symlink is recreated, making it more likely that I can run the resulting
test using build/latest/bin/foo-test.

This also disallows running cmake from inside symlinked build/latest.
If you try to run cmake here, it ends up getting into a very confused
state, where builds fail with hard to decipher messages. It's easier
to just disallow it.

Change-Id: I33fd15c5651a080ae1f320568cb1a60c2f019512
Reviewed-on: http://gerrit.cloudera.org:8080/1962
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins

Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/18dbc453
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/18dbc453
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/18dbc453

Branch: refs/heads/master
Commit: 18dbc453a38c9e43839dbd063e60e4e679ad80cd
Parents: da637d2
Author: Todd Lipcon <todd@apache.org>
Authored: Fri Jan 29 13:50:00 2016 -0800
Committer: Todd Lipcon <todd@apache.org>
Committed: Fri Jan 29 22:28:03 2016 +0000

 CMakeLists.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c67b54a..21100cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,10 @@ endif()
 # build/<second build directory>
 # ...
+    message(FATAL_ERROR "Should not run cmake inside the build/latest symlink. "
+            "First change directories into the destination of the symlink.")
+  endif()
   if (NOT APPLE)
     set(MORE_ARGS "-T")
@@ -53,6 +57,15 @@ if ("${CMAKE_CURRENT_BINARY_DIR}" MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}/build/[^
     COMMENT "Recreating ../build/latest symlink")
+  # 'ALL' above doesn't actually add 'latest_symlink' as a dependency to all
+  # targets. So, we override add_executable to ensure that whenever any executable
+  # is built, the symlink is re-created.
+  function(add_executable name)
+    # Call through to the original add_executable function.
+    _add_executable(${name} ${ARGN})
+    add_dependencies(${name} latest_symlink)
+  endfunction()
 # TODO: can we somehow pass this into the java build?

View raw message