From b38dd3f894490846a7582ccbbe8016a24644b3c3 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Fri, 12 Aug 2022 22:39:53 +0200 Subject: [PATCH] cmake: use *dynamic* fxSDK compiler path as default for gint Previously FXSDK_COMPILER_INSTALL would be stored as the install prefix. However, this prefix is subject to unannounced changes when the compiler version is upgraded without reconfiguring the fxlibc, which happens in the GiteaPC workflow. This commit avoids the use of CMAKE_INSTALL_PREFIX when using gint with no specified prefix, and instead uses another cached variable which leaves the prefix to be dynamically resolved based on the uncached variable FXSDK_COMPILER_INSTALL, like most repositories do (eg. gint). We need the cached indicator because we frequently reconfigure and CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is not persistent. --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 331f8c9..813a1d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,21 @@ if(FXLIBC_TARGET STREQUAL gint) # Default to fxSDK install path if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${FXSDK_COMPILER_INSTALL}" CACHE PATH "..." FORCE) + set(FXLIBC_PREFIX_IS_FXSDK 1 CACHE PATH "..." FORCE) endif() - if(CMAKE_INSTALL_PREFIX STREQUAL "${FXSDK_COMPILER_INSTALL}") - set(LIBDIR ".") - set(INCDIR "include") + if(FXLIBC_PREFIX_IS_FXSDK) + # Use the fxSDK paths; these variables are uncached so we are always up-to- + # date, even if the compiler is upgraded without removing the fxlibc build + # folder (which happens with GiteaPC) + execute_process( + COMMAND fxsdk path include + OUTPUT_VARIABLE INCDIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND fxsdk path lib + OUTPUT_VARIABLE LIBDIR + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() endif()