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.
This commit is contained in:
Lephenixnoir 2022-08-12 22:39:53 +02:00
parent 89c6c39405
commit b38dd3f894
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 13 additions and 4 deletions

View File

@ -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()