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
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -30,12 +30,21 @@ if(FXLIBC_TARGET STREQUAL gint)
# Default to fxSDK install path # Default to fxSDK install path
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 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() endif()
if(CMAKE_INSTALL_PREFIX STREQUAL "${FXSDK_COMPILER_INSTALL}") if(FXLIBC_PREFIX_IS_FXSDK)
set(LIBDIR ".") # Use the fxSDK paths; these variables are uncached so we are always up-to-
set(INCDIR "include") # 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()
endif() endif()