summaryrefslogtreecommitdiff
path: root/acprep
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-05-23 02:00:02 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-05-23 02:00:02 -0500
commit636b878e70d59ae2828dde9632b15808c43d32f4 (patch)
tree35075e2aaad90cff488631bdf20cdca84969e4c6 /acprep
parentc404f94d6419d67b0e93f42b7ea45414220e7100 (diff)
downloadfork-ledger-636b878e70d59ae2828dde9632b15808c43d32f4.tar.gz
fork-ledger-636b878e70d59ae2828dde9632b15808c43d32f4.tar.bz2
fork-ledger-636b878e70d59ae2828dde9632b15808c43d32f4.zip
Give a reasonable error if CMake cannot be found
Diffstat (limited to 'acprep')
-rwxr-xr-xacprep27
1 files changed, 27 insertions, 0 deletions
diff --git a/acprep b/acprep
index 9dba6b94..beaf4d24 100755
--- a/acprep
+++ b/acprep
@@ -38,6 +38,28 @@ LEVELS = {'DEBUG': logging.DEBUG,
search_prefixes = [ '/usr/local', '/opt/local', '/sw', '/usr' ]
+def which(program):
+ def is_exe(fpath):
+ return os.path.exists(fpath) and os.access(fpath, os.X_OK)
+
+ def ext_candidates(fpath):
+ yield fpath
+ for ext in os.environ.get("PATHEXT", "").split(os.pathsep):
+ yield fpath + ext
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ exe_file = os.path.join(path, program)
+ for candidate in ext_candidates(exe_file):
+ if is_exe(candidate):
+ return candidate
+
+ return None
+
class BoostInfo(object):
def dependencies(system):
if system == 'darwin':
@@ -647,6 +669,7 @@ class PrepareBuild(CommandLineApp):
self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include;/opt/local/include')
self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib;/opt/local/lib')
+ self.configure_args.append('-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON')
self.configure_args.append('-DBOOST_ROOT=/usr/local')
self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_49')
self.configure_args.append('-DBoost_COMPILER=-clang-darwin')
@@ -772,6 +795,10 @@ class PrepareBuild(CommandLineApp):
else:
conf_args = ['cmake', self.source_dir]
+ if not which('cmake'):
+ self.log.error("Cannot find CMake, please check your PATH")
+ sys.exit(1)
+
for var in ('CXX', 'CXXFLAGS', 'LDFLAGS'):
if self.envvars.has_key(var) and self.envvars[var] and \
(var.endswith('FLAGS') or exists(self.envvars[var])):