aboutsummaryrefslogtreecommitdiff
path: root/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2012-11-02 10:59:05 +0000
committerXiaotao Duan <xiaotao@google.com>2012-11-07 14:17:48 -0800
commitc981c48f5bc9aefeffc0bcb0cc3934c2fae179dd (patch)
tree54d1c7d66098154c1d7c5bd414394ef4cf255810 /bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
parent63f67d748682b46d58be31235a0a2d64d81b998c (diff)
downloadeigen-c981c48f5bc9aefeffc0bcb0cc3934c2fae179dd.tar.gz
Added a README.android and a MODULE_LICENSE_MPL2 file. Added empty Android.mk and CleanSpec.mk to optimize Android build. Non MPL2 license code is disabled in ./Eigen/src/Core/util/NonMPL2.h. Trying to include such files will lead to an error. Change-Id: I0e148b7c3e83999bcc4dfaa5809d33bfac2aac32
Diffstat (limited to 'bench/btl/cmake/MacroOptionalAddSubdirectory.cmake')
-rw-r--r--bench/btl/cmake/MacroOptionalAddSubdirectory.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake b/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
new file mode 100644
index 000000000..545048b68
--- /dev/null
+++ b/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
@@ -0,0 +1,31 @@
+# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
+# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
+# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
+# this will have two effects
+# 1 - CMake will not complain if the directory doesn't exist
+# This makes sense if you want to distribute just one of the subdirs
+# in a source package, e.g. just one of the subdirs in kdeextragear.
+# 2 - If the directory exists, it will offer an option to skip the
+# subdirectory.
+# This is useful if you want to compile only a subset of all
+# directories.
+
+# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
+ GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
+ IF(EXISTS ${_fullPath})
+ IF(${ARGC} EQUAL 2)
+ OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
+ ELSE(${ARGC} EQUAL 2)
+ OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
+ ENDIF(${ARGC} EQUAL 2)
+ IF(BUILD_${_dir})
+ ADD_SUBDIRECTORY(${_dir})
+ ENDIF(BUILD_${_dir})
+ ENDIF(EXISTS ${_fullPath})
+ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)