From bdf765b69b3a5213509031d54255b241a1f2ae66 Mon Sep 17 00:00:00 2001 From: mbalfour Date: Mon, 19 Apr 2021 09:44:14 -0500 Subject: [PATCH] Fix cmake script to respect the CMAKE_INSTALL_LIBDIR / CMAKE_INSTALL_BINDIR settings for all platforms. --- cmake/AwsSharedLibSetup.cmake | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/AwsSharedLibSetup.cmake b/cmake/AwsSharedLibSetup.cmake index e8e69402f..9c4b0de77 100644 --- a/cmake/AwsSharedLibSetup.cmake +++ b/cmake/AwsSharedLibSetup.cmake @@ -1,13 +1,21 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. -set(LIBRARY_DIRECTORY lib) -set(RUNTIME_DIRECTORY bin) +if(DEFINED CMAKE_INSTALL_LIBDIR) + set(LIBRARY_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) +else() + set(LIBRARY_DIRECTORY lib) +endif() + +if(DEFINED CMAKE_INSTALL_BINDIR) + set(RUNTIME_DIRECTORY ${CMAKE_INSTALL_BINDIR}) +else() + set(RUNTIME_DIRECTORY bin) +endif() + # Set the default lib installation path on GNU systems with GNUInstallDirs if (UNIX AND NOT APPLE) include(GNUInstallDirs) - set(LIBRARY_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) - set(RUNTIME_DIRECTORY ${CMAKE_INSTALL_BINDIR}) # this is the absolute dumbest thing in the world, but find_package won't work without it # also I verified this is correctly NOT "lib64" when CMAKE_C_FLAGS includes "-m32"