Fixed bug 3078 - cmake: fix sdl2.m4 install location on cross hosts
Timo Gurr
On cross hosts running autotools for SDL2_gfx-1.0.1 fails to find sdl2.m4:
eautoreconf: running in /var/tmp/paludis/build/media-libs-SDL2_gfx-1.0.1/work/SDL2_gfx-1.0.1 ...
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
libtoolize --copy --force --automake
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
autoconf
configure.in:128: error: possibly undefined macro: AM_PATH_SDL2
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
* Failed Running autoconf !
SDL2 installs it to /usr/x86_64-pc-linux-gnu/share/aclocal on cross hosts, attached patch makes use of CMAKE_INSTALL_FULL_DATAROOTDIR to support correctly installing to the arch independent location /usr/share/aclocal.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e940ec..b05356b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
endif()
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.5)
project(SDL2 C)
# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
@@ -26,6 +26,7 @@
include(CheckStructHasMember)
include(CMakeDependentOption)
include(FindPkgConfig)
+include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
@@ -1608,7 +1609,7 @@
endif()
install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
# TODO: what about the .spec file? Is it only needed for RPM creation?
- install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
+ install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
endif()
##### Uninstall target #####