New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Improve config installation #2849
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,9 @@ | ||
|
||
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
if(NOT CURL_FIND_COMPONENTS) | ||
set(CURL_FIND_COMPONENTS curl libcurl) | ||
if(CURL_FIND_REQUIRED) | ||
set(CURL_FIND_REQUIRED_curl TRUE) | ||
set(CURL_FIND_REQUIRED_libcurl TRUE) | ||
endif() | ||
endif() | ||
@PACKAGE_INIT@ | ||
|
||
if("@USE_OPENSSL@") | ||
include(CMakeFindDependencyMacro) | ||
find_dependency(OpenSSL "@OPENSSL_VERSION_MAJOR@") | ||
endif() | ||
|
||
set(_curl_missing_components) | ||
foreach(_comp ${CURL_FIND_COMPONENTS}) | ||
if(EXISTS "${_DIR}/${_comp}-target.cmake") | ||
include("${_DIR}/${_comp}-target.cmake") | ||
set(CURL_${_comp}_FOUND TRUE) | ||
else() | ||
set(CURL_${_comp}_FOUND FALSE) | ||
if(CURL_FIND_REQUIRED_${_comp}) | ||
set(CURL_FOUND FALSE) | ||
list(APPEND _curl_missing_components ${_comp}) | ||
endif() | ||
endif() | ||
endforeach() | ||
|
||
if(_curl_missing_components) | ||
set(CURL_NOT_FOUND_MESSAGE "Following required components not found: " ${_curl_missing_components}) | ||
else() | ||
if(TARGET CURL::libcurl) | ||
string(TOUPPER "${CMAKE_BUILD_TYPE}" _curl_current_config) | ||
if(NOT _curl_current_config) | ||
set(_curl_current_config "NOCONFIG") | ||
endif() | ||
get_target_property(_curl_configurations CURL::libcurl IMPORTED_CONFIGURATIONS) | ||
list(FIND _curl_configurations "${_curl_current_config}" _i) | ||
if(_i LESS 0) | ||
set(_curl_config "RELEASE") | ||
list(FIND _curl_configurations "${_curl_current_config}" _i) | ||
if(_i LESS 0) | ||
set(_curl_config "NOCONFIG") | ||
list(FIND _curl_configurations "${_curl_current_config}" _i) | ||
endif() | ||
endif() | ||
|
||
if(_i LESS 0) | ||
set(_curl_current_config "") # let CMake pick config at random | ||
else() | ||
set(_curl_current_config "_${_curl_current_config}") | ||
endif() | ||
|
||
get_target_property(CURL_INCLUDE_DIRS CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES) | ||
get_target_property(CURL_LIBRARIES CURL::libcurl "LOCATION${_curl_current_config}") | ||
set(_curl_current_config) | ||
set(_curl_configurations) | ||
set(_i) | ||
endif() | ||
endif() | ||
|
||
unset(_curl_missing_components) | ||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") | ||
check_required_components("@PROJECT_NAME@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been using vcpkg for building out libraries on Windows. One of its expectations is that lib files just contain object code. With things like cmake files it wants them to go into share/curl. Its pretty good about CMake conventions so I figured I'd mention it.
Other than that this looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clarify is it relate to this patch or it's something you just want to have? Because before it was
CMake
and wasn'tshare/curl
as you are expecting.As a note there is no hard requirement for the layout on CMake side, from documentation:
So for simplicity reason it make sense to use same layout on all platforms.
${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
is a generalization of previously usedlib/cmake/curl
.