minecraft-pi-docker/cmake/toolchain/base-toolchain.cmake

38 lines
1.3 KiB
CMake
Raw Normal View History

2021-09-14 22:10:32 +00:00
# Setup Toolchain
macro(setup_toolchain target)
2022-07-13 15:58:35 +00:00
# Target Variants
set(target_variants "${target}")
macro(add_target_variant value)
string(REPLACE "-linux" "-${value}-linux" target_variant "${target}")
list(APPEND target_variants "${target_variant}")
endmacro()
add_target_variant(unknown)
add_target_variant(none)
add_target_variant(pc)
2024-02-04 02:07:53 +00:00
2022-07-13 15:58:35 +00:00
# Find Compiler
macro(find_compiler output name)
set(possible_names "")
foreach(possible_target IN LISTS target_variants)
list(APPEND possible_names "${possible_target}-${name}")
endforeach()
find_program(
"${output}"
NAMES ${possible_names}
NO_CACHE
)
if("${${output}}" STREQUAL "${output}-NOTFOUND")
message(FATAL_ERROR "Unable To Find ${name}")
endif()
endmacro()
find_compiler(CMAKE_C_COMPILER "gcc")
find_compiler(CMAKE_CXX_COMPILER "g++")
2024-02-04 02:07:53 +00:00
2021-09-14 22:10:32 +00:00
# Extra
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
2022-06-12 20:23:32 +00:00
# Custom Search Paths
2024-02-04 02:07:53 +00:00
set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}" "/usr")
# pkg-config
set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/${target}/pkgconfig:/usr/${target}/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig")
2021-09-14 22:10:32 +00:00
endmacro()