]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Added fallback macros for add_compile_options and add_link_options.
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 24 Jan 2022 03:53:22 +0000 (19:53 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 29 Jan 2022 15:44:21 +0000 (16:44 +0100)
CMakeLists.txt
cmake/fallback-macros.cmake [new file with mode: 0644]

index b9de19a7552657c26fd5929cda43d354b9b4a4a7..dfdc98bbb7b7d8d7dd0febc2bcd7ab7996dc8a91 100644 (file)
@@ -51,6 +51,7 @@ include(cmake/detect-install-dirs.cmake)
 include(cmake/detect-coverage.cmake)
 include(cmake/detect-intrinsics.cmake)
 include(cmake/detect-sanitizer.cmake)
+include(cmake/fallback-macros.cmake)
 
 if(CMAKE_TOOLCHAIN_FILE)
     message(STATUS "Using CMake toolchain: ${CMAKE_TOOLCHAIN_FILE}")
diff --git a/cmake/fallback-macros.cmake b/cmake/fallback-macros.cmake
new file mode 100644 (file)
index 0000000..8bc6cf2
--- /dev/null
@@ -0,0 +1,19 @@
+# fallback-macros.cmake -- CMake fallback macros
+# Copyright (C) 2022 Nathan Moinvaziri
+# Licensed under the Zlib license, see LICENSE.md for details
+
+# CMake less than version 3.5.2
+if(NOT COMMAND add_compile_options)
+    macro(add_compile_options options)
+        string(APPEND CMAKE_C_FLAGS ${options})
+        string(APPEND CMAKE_CXX_FLAGS ${options})
+    endmacro()
+endif()
+
+# CMake less than version 3.14
+if(NOT COMMAND add_link_options)
+    macro(add_link_options options)
+        string(APPEND CMAKE_EXE_LINKER_FLAGS ${options})
+        string(APPEND CMAKE_SHARED_LINKER_FLAGS ${options})
+    endmacro()
+endif()