]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: use the `LINK_OPTIONS` property with CMake 3.13+
authorViktor Szakats <commit@vsz.me>
Sat, 12 Apr 2025 15:36:02 +0000 (17:36 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 12 Apr 2025 18:59:44 +0000 (20:59 +0200)
Replacing the superseded `LINK_FLAGS` in these versions.

Follow-up to 7b1444979094a365c82c665cce0e2ebc6b69467b #14378
Closes #17039

lib/CMakeLists.txt

index 5ac343df06fc94a1215e1f976161097f463621da..9645cba768a43cbcc49f27f32f14eb016a75bda2 100644 (file)
@@ -265,8 +265,11 @@ if(BUILD_SHARED_LIBS)
     set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libcurl.vers")
     check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSIONED_SYMBOLS)
     if(HAVE_VERSIONED_SYMBOLS)
-      # Superseded by LINK_OPTIONS in CMake 3.13 and later.
-      set_target_properties(${LIB_SHARED} PROPERTIES LINK_FLAGS "${CMAKE_REQUIRED_LINK_OPTIONS}")
+      if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
+        set_target_properties(${LIB_SHARED} PROPERTIES LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}")
+      else()
+        set_target_properties(${LIB_SHARED} PROPERTIES LINK_FLAGS "${CMAKE_REQUIRED_LINK_OPTIONS}")
+      endif()
     else()
       message(WARNING "Versioned symbols requested, but not supported by the toolchain.")
     endif()