Skip to content

cmake: don't use quotes for GSS-API paths - #15536

Closed
diizzyy wants to merge 1 commit into
curl:masterfrom
diizzyy:patch-2
Closed

diizzyy wants to merge 1 commit into
curl:masterfrom
diizzyy:patch-2

Conversation

@diizzyy

@diizzyy diizzyy commented Nov 10, 2024

Copy link
Copy Markdown
Contributor

Otherwise paths ends up as -L"/usr/local" instead of -L/usr/local

Otherwise paths ends up as -L"/usr/local" instead of -L/usr/local
@vszakats

Copy link
Copy Markdown
Member

Are you sure the quotes weren't added there (in 558814e) to make these options work on Windows, where GSS may be detected on path with spaces? Are the quotes breaking something?

@diizzyy

diizzyy commented Nov 10, 2024

Copy link
Copy Markdown
Contributor Author

It's at least inconsistent with GNU Autotools but I guess you could add it specificly for Windows

@vszakats

Copy link
Copy Markdown
Member

It's at least inconsistent with GNU Autotools but I guess you could add it specificly for Windows

autotools doesn't support MSVC, and missed the Windows-specific detection.

What about avoiding the manual flag creation altogether?:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1200,10 +1200,6 @@ if(CURL_USE_GSSAPI)
     string(REPLACE ";" " " GSS_CFLAGS "${GSS_CFLAGS}")
     string(REPLACE ";" " " GSS_LDFLAGS "${GSS_LDFLAGS}")
 
-    foreach(_dir IN LISTS GSS_LIBRARY_DIRS)
-      set(GSS_LDFLAGS "${GSS_LDFLAGS} -L\"${_dir}\"")
-    endforeach()
-
     if(NOT GSS_FLAVOUR STREQUAL "GNU")
       set(_include_list "")
       check_include_file("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
@@ -1222,7 +1218,10 @@ if(CURL_USE_GSSAPI)
         endif()
 
         if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
-          set(CMAKE_REQUIRED_FLAGS "${GSS_CFLAGS} ${GSS_LDFLAGS}")
+          foreach(_dir IN LISTS GSS_LIBRARY_DIRS)
+            curl_required_libpaths(${_dir})
+          endforeach()
+          set(CMAKE_REQUIRED_FLAGS ${GSS_CFLAGS})
           set(CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
           check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
         endif()
@@ -1237,8 +1236,6 @@ if(CURL_USE_GSSAPI)
     include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
     link_directories(${GSS_LIBRARY_DIRS})
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_CFLAGS}")
-    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GSS_LDFLAGS}")
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GSS_LDFLAGS}")
     list(APPEND CURL_LIBS ${GSS_LIBRARIES})
     if(GSS_FLAVOUR STREQUAL "GNU")
       set(HAVE_GSSGNU 1)
  • CMAKE_SHARED_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS seem redundant over link_directories().
  • use curl_required_libpaths() to pass the libpaths to the feature test.

vszakats added a commit to vszakats/curl that referenced this pull request Nov 11, 2024
- drop `CMAKE_SHARED_LINKER_FLAGS` and `CMAKE_EXE_LINKER_FLAGS` that
  seem redundant over `link_directories()`
- add libpaths to `CURL_LIBPATHS`.
- use `curl_required_libpaths()` to pass the libpaths to the
  feature test.

Fixes curl#15536
@vszakats

Copy link
Copy Markdown
Member

Proposing #15545 to tidy up this and some more.

@diizzyy

diizzyy commented Nov 12, 2024

Copy link
Copy Markdown
Contributor Author

I guess that's fine, can't test it until the weekend though

@vszakats

vszakats commented Nov 14, 2024 •

Copy link
Copy Markdown
Member

@diizzyy: Looking forward for your feedback. If #15545 works I plan to merge it for the upcoming bugfix release.

talregev pushed a commit to talregev/curl that referenced this pull request Nov 14, 2024
- drop `CMAKE_SHARED_LINKER_FLAGS` and `CMAKE_EXE_LINKER_FLAGS` that
  seem redundant over `link_directories()`
- add libpaths to `CURL_LIBPATHS`.
- use `curl_required_libpaths()` to pass the libpaths to the
  feature test.

Fixes curl#15536
@vszakats vszakats closed this in e0e93d4 Nov 14, 2024
@diizzyy

diizzyy commented Nov 19, 2024

Copy link
Copy Markdown
Contributor Author

@vszakats
Out of curiosity, is there a date set for the bugfix release?

@dfandrich

dfandrich commented Nov 19, 2024 via email

Copy link
Copy Markdown
Contributor

@vszakats

Copy link
Copy Markdown
Member

@diizzyy Yes, there is, it's scheduled for Dec. 11.

curl/curl-www@45be531

@diizzyy

diizzyy commented Nov 19, 2024

Copy link
Copy Markdown
Contributor Author

Ahh ok, I was under the impression it would be sooner for a bugfix release

pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
- stop passing explicit libpaths via `CMAKE_SHARED_LINKER_FLAGS` and
  `CMAKE_EXE_LINKER_FLAGS`. `link_directories()` is doing that already.
- use `curl_required_libpaths()` to pass libpaths to the feature test.
  Reported-by: Daniel Engberg
  Fixes curl#15536
  Also fixes GSS feature detection with non-gcc/clang compilers,
  such as MSVC.
- add libpaths to `CURL_LIBPATHS`.
- move `GSS_CFLAGS`, `GSS_LDFLAGS` stringifications to FindGSS.
  To match the `CFLAGS` format returned by the rest of Find modules.
- reorder calls to match other dependencies.
- don't extend system `LDFLAGS` when FindGSS did not return any.
- ignore `LDFLAGS` when detecting GSS via `pkg-config`. `LDFLAGS` holds
  a copy of libpaths and libs in this case. Ignore those to avoid these
  duplicates making into `libcurl.pc` and `curl-config`. Also syncing
  behavior with other Find modules which also ignore raw `LDFLAGS`.
- ignore raw `LDFLAGS` coming from `krb5-config --libs`. FindGSS
  no longer returns dependency-specific `LDFLAGS` after this. Syncing
  behavior with other Find modules.
- reduce scope of checker state push/pop/set.

Closes curl#15545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants