cmake: automatically find libraries in FXSDK_PREFIX

This paves the way for out-of-compiler installs which might become a
relevant thing for packaging and dual gint/PrizmSDK users (if it ever
happens).
This commit is contained in:
Lephenixnoir 2021-05-25 20:56:20 +02:00
parent 6383e1a30e
commit 30befdd2cf
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 16 additions and 6 deletions

View file

@ -27,11 +27,16 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(FXSDK_CMAKE_MODULE_PATH "${FXSDK_CMAKE_MODULE_PATH}")
# Add the fxSDK prefix path to the search
set(FXSDK_PREFIX "$ENV{FXSDK_PREFIX}")
foreach(DIR IN LISTS FXSDK_PREFIX)
include_directories("${DIR}/include")
link_directories("${DIR}/lib")
endforeach()
# Determine compiler install path
execute_process(
COMMAND ${CMAKE_C_COMPILER} --print-search-dirs
COMMAND head -n 1
COMMAND sed -E "s/^[^:]+: //"
COMMAND ${CMAKE_C_COMPILER} --print-file-name=.
OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL
OUTPUT_STRIP_TRAILING_WHITESPACE
)

View file

@ -27,11 +27,16 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(FXSDK_CMAKE_MODULE_PATH "${FXSDK_CMAKE_MODULE_PATH}")
# Add the fxSDK prefix path to the search
set(FXSDK_PREFIX "$ENV{FXSDK_PREFIX}")
foreach(DIR IN LISTS FXSDK_PREFIX)
include_directories("${DIR}/include")
link_directories("${DIR}/lib")
endforeach()
# Determine compiler install path
execute_process(
COMMAND ${CMAKE_C_COMPILER} --print-search-dirs
COMMAND head -n 1
COMMAND sed -E "s/^[^:]+: //"
COMMAND ${CMAKE_C_COMPILER} --print-file-name=.
OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL
OUTPUT_STRIP_TRAILING_WHITESPACE
)