#!/bin/sh
# Alter the target architecture for a sandbox when using CMake
# sb_retarget
# Copyright (C) 2012 - 2018 FARGOS Development, LLC
# $Id$
originDir=`dirname ${0}`

if test -z "${STS}"
then
	printf "%s: no active workon.\n" "${0}" >&2
	exit 1
fi

# Make sure architecture-specific output directories exist
mkdir -p ${STL} ${STB} ${STO}

# Regenerate CMake files, if needed
for f in ${STS}/*/CMakeLists.txt
do
	if test ! -e "${f}"
	then
		break
	fi
	dir=`dirname ${f}`
	cd ${dir}
	echo Retarget directory `basename ${dir}`
	${originDir}/cmake.setTarget 
done

