Improve Clang Toolchain
This commit is contained in:
parent
647a482fbd
commit
a338c11f9d
@ -1,16 +1,18 @@
|
|||||||
# Pick GCC Version
|
# Pick GCC Version
|
||||||
macro(pick_gcc_version gcc_root gcc_version)
|
macro(pick_gcc_version gcc_root gcc_version)
|
||||||
|
if(NOT DEFINED "${gcc_version}")
|
||||||
file(GLOB children RELATIVE "${gcc_root}" "${gcc_root}/*")
|
file(GLOB children RELATIVE "${gcc_root}" "${gcc_root}/*")
|
||||||
set("${gcc_version}" "")
|
set("${gcc_version}" "" CACHE STRING "" FORCE)
|
||||||
foreach(child IN LISTS children)
|
foreach(child IN LISTS children)
|
||||||
if(IS_DIRECTORY "${gcc_root}/${child}" AND ("${${gcc_version}}" STREQUAL "" OR "${child}" GREATER_EQUAL "${${gcc_version}}"))
|
if(IS_DIRECTORY "${gcc_root}/${child}" AND ("${${gcc_version}}" STREQUAL "" OR "${child}" GREATER_EQUAL "${${gcc_version}}"))
|
||||||
set("${gcc_version}" "${child}")
|
set("${gcc_version}" "${child}" "" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
if("${${gcc_version}}" STREQUAL "")
|
if("${${gcc_version}}" STREQUAL "")
|
||||||
message(FATAL_ERROR "Unable To Pick GCC Version")
|
message(FATAL_ERROR "Unable To Pick GCC Version")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Using GCC Version: ${${gcc_version}}")
|
message(STATUS "Using GCC Version: ${${gcc_version}}")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Setup Toolchain
|
# Setup Toolchain
|
||||||
@ -22,11 +24,10 @@ macro(setup_toolchain target)
|
|||||||
set(CMAKE_CXX_COMPILER_TARGET "${target}")
|
set(CMAKE_CXX_COMPILER_TARGET "${target}")
|
||||||
set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}")
|
set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}")
|
||||||
# Include Directories
|
# Include Directories
|
||||||
set(NEW_FLAGS "-nostdinc -nostdinc++ -Wno-unused-command-line-argument")
|
pick_gcc_version("/usr/lib/gcc-cross/${target}" GCC_VERSION)
|
||||||
|
set(NEW_FLAGS "-nostdinc -nostdinc++ -Wno-unused-command-line-argument -isystem /usr/lib/gcc-cross/${target}/${GCC_VERSION}/include -isystem /usr/${target}/include/c++/${GCC_VERSION} -isystem /usr/${target}/include/c++/${GCC_VERSION}/${target} -isystem /usr/${target}/include")
|
||||||
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ${NEW_FLAGS}")
|
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} ${NEW_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} ${NEW_FLAGS}")
|
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} ${NEW_FLAGS}")
|
||||||
pick_gcc_version("/usr/lib/gcc-cross/${target}" GCC_VERSION)
|
|
||||||
include_directories(SYSTEM "/usr/lib/gcc-cross/${target}/${GCC_VERSION}/include" "/usr/${target}/include/c++/${GCC_VERSION}" "/usr/${target}/include/c++/${GCC_VERSION}/${target}" "/usr/${target}/include")
|
|
||||||
# Extra
|
# Extra
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
Loading…
Reference in New Issue
Block a user