This study enlightens how the magnetic anisotropy might be tailored in magnetic films by the proper choice of the substrate. Single crystalline (111)SmAl2 films have been grown by molecular beam epitaxy on two substrates: (112¯0)Al2O3 and (111)CaF2. Hysteresis loops measured along the different crystallographic directions are the signature of the following: (i) a uniaxial anisotropy with an easy direction perpendicular to the (111) growth plane when the film is grown on Al2O3; (ii) a [111] hard magnetic direction when the film is grown on CaF2. This effect can be understood if we consider the influence of the thermal strains on the various energy terms which govern the easy magnetization direction. The relevant parameters to determine the easy magnetization direction are the relative sign and absolute values of the strains and of the magnetoelastic constants.