[PATCH] CMake: configure and install sdl2-config.cmake

Aleksandr Mezin <[email protected]> Mon, 13 Feb 2017 06:12:46 +0600
Newsgroups gmane.comp.lib.sdl
Message-ID <CADnvcf+LMtiAUC+cz=wjMOx=hhv682jDXNzNq2Jj87TVRH6NYw@mail.gmail.com>
Autotools build scripts installed sdl2-config.cmake, but CMake build
scripts did't.
This patch fixes the problem. Though there is still no config for MSVC builds.

---
 CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe7e22a..6cb8739 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1506,8 +1506,8 @@ if(NOT WINDOWS OR CYGWIN)

   configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in"
     "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY)
-  configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
-    "${SDL2_BINARY_DIR}/sdl2-config")
+  configure_file("${SDL2_SOURCE_DIR}/sdl2-config.cmake.in"
+    "${SDL2_BINARY_DIR}/sdl2-config.cmake" @ONLY)
   configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
     "${SDL2_BINARY_DIR}/sdl2-config" @ONLY)
   configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in"
@@ -1637,6 +1637,8 @@ if(NOT (WINDOWS OR CYGWIN))
     install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
       DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
   endif()
+  install(FILES ${SDL2_BINARY_DIR}/sdl2-config.cmake
+    DESTINATION "lib${LIB_SUFFIX}/cmake/SDL2")
   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
"${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
--
2.10.1 (Apple Git-78)