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.
Issue #:
Description of changes:
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.9...3.31)
CMAKE_INSTALL_LIBDIR
,CMAKE_INSTALL_BINDIR
,CMAKE_INSTALL_INCLUDEDIR
LIBRARY_DIRECTORY,RUNTIME_DIRECTORY)include(GNUInstallDirs)
on all platformsGNUInstallDirs
wasn't safe for Windows and Apple, but despite its name, it's fine. Professional CMake says:aws-c-common-config.cmake
lib/aws-c-common/cmake/...
lib/cmake/aws-c-common/...
AwsCFlags.cmake
lib/cmake/...
lib/cmake/aws-c-common/modules/...
aws-c-common-config.cmake
so that, when any dependency callsfind_package(aws-c-common)
, theCMAKE_MODULE_PATH
is modified to include the installed location of modules likeAwsCFlags.cmake
.FIND_LIBRARY_USE_LIB64_PATHS
, just let CMake handle itREASONING: Here's what Professional CMake: A Practical Guide 12th Edition has to say on this topic:
This wasn't causing issues, but I'm trying to cut down on the hacky boilerplate copy/pasted into dozens of other CMake files amongst our repos. In the PR that introduced this, it's commented with "this is the absolute dumbest thing in the world" and a reviewer mentions that it's not necessary in aws-sdk-cpp. My best guess as to why it seemed necessary is that we were trying to get cross-compile working somewhere and this fixed it. But it seems like the real fix is to address this in the cross-compilation toolchain file. It shouldn't be up to every CMake library on earth to include this hack. Removing now in 2024 doesn't seem to cause any issues, so 🪓
Thanks to @r-burns @madebr @glaubitz and others for helpful comments, and the Pull Requests it took us years to finally look at
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.