You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[suggest] Change the IMPORTED target name to libssh2::libssh2 or Libssh2::Libssh2. #731
If the IMPORTED target name is provided in form of <pkg>::<pkg>, I think it is better to keep the case of letters <pkg> the SAME, which means libssh2::libssh2 or Libssh2::Libssh2.
changed the title [-][suggest] Change the IMPORTED target name to `libssh2::libssh2`.[/-][+][suggest] Change the IMPORTED target name to `libssh2::libssh2` or `Libssh2::Libssh2`.[/+]on Aug 4, 2022
@hwhsu1231 shouldn't the line 406 also be changed to lower case? Also, if upper casing, the output file would probably have to be renamed, otherwise you'll get "Libssh2.so", which would wreak havoc.
@willco007 the changes will only impact CMake users that previously used "Libssh2::libssh2" imported target.
shouldn't the line 406 also be changed to lower case? Also, if upper casing, the output file would probably have to be renamed, otherwise you'll get "Libssh2.so", which would wreak havoc.
Yes, I think so if the schema 1 is adopted.
the changes will only impact CMake users that previously used "Libssh2::libssh2" imported target.
How about prepare the old target and the new one simultaneously for a while? And then, add some comments in the source code to tell users that the old one will be deprecated in the future?
Here's a patch proposal for the current master, in case we want to pursue this:
diff --git a/docs/INSTALL_CMAKE.md b/docs/INSTALL_CMAKE.md
index fe203068..47ca7318 100644
--- a/docs/INSTALL_CMAKE.md+++ b/docs/INSTALL_CMAKE.md@@ -168,8 +168,8 @@ setting it up with libssh2's location. Just add just the following
lines and CMake will find libssh2 on your system, set up the necessary
paths and link the library with your binary.
- find_package(Libssh2 REQUIRED CONFIG)- target_link_libraries(my_project_target Libssh2::libssh2)+ find_package(libssh2 REQUIRED CONFIG)+ target_link_libraries(my_project_target libssh2::libssh2)
Of course, you still have to make libssh2 available on your system
first. You can install it in the traditional way shown above, but you
@@ -184,13 +184,13 @@ builds your project:
include(ExternalProject)
ExternalProject_Add(
- Libssh2+ libssh2
URL <libssh2 download location>
URL_HASH SHA1=<libssh2 archive SHA1>
INSTALL_COMMAND "")
ExternalProject_Add(
- MyProject DEPENDS Libssh2+ MyProject DEPENDS libssh2
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
INSTALL_COMMAND "")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c35237c8..8ebdad94 100644
--- a/src/CMakeLists.txt+++ b/src/CMakeLists.txt@@ -457,13 +457,13 @@ set(RUNTIME_DEPENDENCIES ${_RUNTIME_DEPENDENCIES} CACHE INTERNAL
## During package installation, install Libssh2Config.cmake
install(EXPORT Libssh2Config
- NAMESPACE Libssh2::+ NAMESPACE libssh2::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libssh2)
## During build, register directly from build tree
# create Libssh2Config.cmake
-export(TARGETS ${libssh2_export} NAMESPACE Libssh2:: FILE Libssh2Config.cmake)-export(PACKAGE Libssh2) # register it+export(TARGETS ${libssh2_export} NAMESPACE libssh2:: FILE Libssh2Config.cmake)+export(PACKAGE libssh2) # register it
## Export a .pc file for client projects not using CMaek
if(PC_REQUIRES_PRIVATE)
This was implemented in 2da13c1 while also keeping compatibility. ('Restoring' would be more precise as compatibility broke in v1.11.0 due to other changes).
Activity
[-][suggest] Change the IMPORTED target name to `libssh2::libssh2`.[/-][+][suggest] Change the IMPORTED target name to `libssh2::libssh2` or `Libssh2::Libssh2`.[/+]willco007 commentedon Nov 3, 2022
I'd probably vote for lower case; how does this impact folks using a pre-build library?
jzakrzewski commentedon Nov 16, 2022
@hwhsu1231 shouldn't the line 406 also be changed to lower case? Also, if upper casing, the output file would probably have to be renamed, otherwise you'll get "Libssh2.so", which would wreak havoc.
@willco007 the changes will only impact CMake users that previously used "Libssh2::libssh2" imported target.
willco007 commentedon Nov 16, 2022
@bagder What do you think about this change?
hwhsu1231 commentedon Jan 10, 2023
@jzakrzewski
Yes, I think so if the schema 1 is adopted.
How about prepare the old target and the new one simultaneously for a while? And then, add some comments in the source code to tell users that the old one will be deprecated in the future?
hwhsu1231 commentedon Jan 10, 2023
However, considering the backward compatibility, maybe it's better to keep the current imported target name.
vszakats commentedon Mar 23, 2023
Here's a patch proposal for the current master, in case we want to pursue this:
vszakats commentedon Apr 20, 2023
We won't do this now to retain compatibility, but would welcome a patch that would be exporting both names simultaneously, as suggested here.
cmake: re-add Libssh2:libssh2 for compatibiliy + switch to lowercase …
cmake: re-add `Libssh2:libssh2` for compatibiliy + lowercase namespace
vszakats commentedon Jun 25, 2023
This was implemented in 2da13c1 while also keeping compatibility. ('Restoring' would be more precise as compatibility broke in v1.11.0 due to other changes).
cmake: re-add `Libssh2:libssh2` for compatibiliy + lowercase namespace
cmake: re-add `Libssh2:libssh2` for compatibiliy + lowercase namespace