chiark / gitweb /
Support earlier versions of CMake.
authorSimon Tatham <anakin@pobox.com>
Sat, 3 Apr 2021 07:03:25 +0000 (08:03 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Apr 2021 07:03:25 +0000 (08:03 +0100)
At least, for the Unix build, so as to support Debian stable and a
couple of prior Ubuntu LTSes.

Not much needed to change in the cmake scripts; the only noticeable
difference was that the 'install' command needs an explicit RUNTIME
DESTINATION.

CMakeLists.txt
cmake/platforms/unix.cmake

index 86c6c084ee8aeb93c30fa0338f3bb873e30dbdb4..058107a8b9502685e46ded2d0f86d3ba1f1b1277 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.5)
 
 project(puzzles
   LANGUAGES C)
index aeff79702500695c0d913a30ca721453312ccb64..3398b9d4eb1dc2b7eda8eb8557a16b7401095c58 100644 (file)
@@ -66,7 +66,16 @@ endfunction()
 function(set_platform_puzzle_target_properties NAME TARGET)
   set_target_properties(${TARGET} PROPERTIES
     OUTPUT_NAME ${NAME_PREFIX}${NAME})
-  install(TARGETS ${TARGET})
+
+  if(CMAKE_VERSION VERSION_LESS 3.14)
+    # CMake 3.13 and earlier required an explicit install destination.
+    install(TARGETS ${TARGET} RUNTIME DESTINATION bin)
+  else()
+    # 3.14 and above selects a sensible default, which we should avoid
+    # overriding here so that end users can override it using
+    # CMAKE_INSTALL_BINDIR.
+    install(TARGETS ${TARGET})
+  endif()
 endfunction()
 
 function(build_platform_extras)