blob: 356bdfca668b3e7ba93004066f9c1969b0068f59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
# On 2013-05-14 Arnold wrote in an e-mail:
# <QUOTE)
# I think that using CMake would be more palatable if there is also a simple
# configure wrapper that can be used by people who build distributions. This would
# mean things like
#
# configure CC=XXXX # XXXX in { gcc, clang, tcc } or native platform cc
# configure --prefix=/path/to/install
#
# And the few other current configure options like --with-whiny-user-strftime,
# --disable-nls, etc. I don't know if we need all the standard configure options,
# 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.
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 )
PREFIX=""
for p in $@
do
if [ ${p:0:3} = "CC=" ]; then CC=${p:3}; fi
if [ ${p:0:9} = "--prefix=" ]; then PREFIX=-DCMAKE_INSTALL_PREFIX=${p:9}; fi
done
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 ${PREFIX} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake ..
|