aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-19 15:55:07 +0200
committerJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-19 15:55:07 +0200
commit20c76cfdadff3bf969279038ac0408ec179a8efd (patch)
treefa423e540190cc40d3933005aeb67af12283cf2a
parent540418bc7d1f84f7f1cdabbc9ccb093447f1c320 (diff)
downloadegawk-20c76cfdadff3bf969279038ac0408ec179a8efd.tar.gz
egawk-20c76cfdadff3bf969279038ac0408ec179a8efd.tar.bz2
egawk-20c76cfdadff3bf969279038ac0408ec179a8efd.zip
First outline of the configure script invokes cmake.
-rwxr-xr-x[-rw-r--r--]cmake/configure35
1 files changed, 32 insertions, 3 deletions
diff --git a/cmake/configure b/cmake/configure
index f79d4c45..922568de 100644..100755
--- a/cmake/configure
+++ b/cmake/configure
@@ -1,3 +1,4 @@
+#!/bin/sh
# On 2013-05-14 Arnold wrote in an e-mail:
# <QUOTE)
@@ -13,7 +14,35 @@
# but I do want the ones I've added in configure.ac.
# </QUOTE)
+
# Anyone using this script still needs an out-of-source build directory.
-# This script should first check if it was invoked from outside the source directory.
-# Then it shall evaluate all the options and translate the options into CMake variables.
-# Finally the script shall invoke CMake.
+if [ -f CMakeLists.txt ] ; then
+ echo "Your current working directory contains a file CMakeLists.txt, indicating"
+ echo "that this is a source directory. Create a new directory elsewhere, change into"
+ echo "this empty directory and try again."
+ echo " mkdir build"
+ echo " cd build"
+ echo " ../$0"
+ exit 1
+fi
+
+if ! [ -f ../CMakeLists.txt ] ; then
+ echo "The directory above your current working directory does not contain a file CMakeLists.txt."
+ echo "This script will run only if you are one level below the source directory."
+ exit 1
+fi
+
+# TODO: Evaluate all the options and translate the options into CMake variables.
+CC=$( which cc )
+rm -f Toolchain.cmake
+(
+ echo "set(CMAKE_C_COMPILER $CC)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)"
+) > Toolchain.cmake
+
+# TODO: Allow the build directory to be in other places.
+# A parameter is needed to pass the value.
+cmake -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake ..
+