STYLE: don't use an extra file to generate CMakeSystem.cmake but instead
configure the toolchain file into it if required -also search for nm, objdump and objcpy, so these can be used in macros Alex
This commit is contained in:
parent
984b0adc5f
commit
b100fe1fe1
|
@ -73,9 +73,10 @@ IF(CMAKE_TOOLCHAIN_FILE)
|
||||||
ENDIF(NOT _INCLUDED_TOOLCHAIN_FILE)
|
ENDIF(NOT _INCLUDED_TOOLCHAIN_FILE)
|
||||||
|
|
||||||
IF(_INCLUDED_TOOLCHAIN_FILE)
|
IF(_INCLUDED_TOOLCHAIN_FILE)
|
||||||
SET(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}")
|
SET(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
|
||||||
ELSE(_INCLUDED_TOOLCHAIN_FILE)
|
ELSE(_INCLUDED_TOOLCHAIN_FILE)
|
||||||
MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
|
MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
|
||||||
|
SET(CMAKE_TOOLCHAIN_FILE "NOTFOUND" CACHE FILEPATH "The CMake toolchain file" FORCE)
|
||||||
ENDIF(_INCLUDED_TOOLCHAIN_FILE)
|
ENDIF(_INCLUDED_TOOLCHAIN_FILE)
|
||||||
ENDIF(CMAKE_TOOLCHAIN_FILE)
|
ENDIF(CMAKE_TOOLCHAIN_FILE)
|
||||||
|
|
||||||
|
@ -138,26 +139,16 @@ IF(CMAKE_BINARY_DIR)
|
||||||
"The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
|
"The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
|
||||||
ENDIF(PRESET_CMAKE_SYSTEM_NAME)
|
ENDIF(PRESET_CMAKE_SYSTEM_NAME)
|
||||||
|
|
||||||
|
# if a toolchain file is used, it needs to be included in the configured file,
|
||||||
# if a toolchain file is used use configure_file() to copy it into the
|
# so settings done there are also available if they don't go in the cache and in TRY_COMPILE()
|
||||||
# build tree, because this way e.g. ${CMAKE_SOURCE_DIR} will be replaced
|
SET(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED)
|
||||||
# with its full path, and so it will also work when used in try_compile()
|
IF(DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
IF (CMAKE_TOOLCHAIN_FILE)
|
SET(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "INCLUDE(\"${CMAKE_TOOLCHAIN_FILE}\")")
|
||||||
|
ENDIF(DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
SET(_OWN_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
|
||||||
CONFIGURE_FILE(${CMAKE_TOOLCHAIN_FILE}
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeToolchainFile.cmake)
|
|
||||||
|
|
||||||
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in
|
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
|
|
||||||
IMMEDIATE @ONLY)
|
|
||||||
ELSE (CMAKE_TOOLCHAIN_FILE)
|
|
||||||
|
|
||||||
# configure variables set in this file for fast reload, the template file is defined at the top of this file
|
# configure variables set in this file for fast reload, the template file is defined at the top of this file
|
||||||
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
|
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
|
||||||
IMMEDIATE @ONLY)
|
IMMEDIATE @ONLY)
|
||||||
|
|
||||||
ENDIF (CMAKE_TOOLCHAIN_FILE)
|
|
||||||
|
|
||||||
ENDIF(CMAKE_BINARY_DIR)
|
ENDIF(CMAKE_BINARY_DIR)
|
||||||
|
|
|
@ -47,7 +47,17 @@ ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
||||||
FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
||||||
FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld)
|
FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER)
|
FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
||||||
|
FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm)
|
||||||
|
|
||||||
|
FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
||||||
|
FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump)
|
||||||
|
|
||||||
|
FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
||||||
|
FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY)
|
||||||
|
|
||||||
ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
||||||
OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
|
OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
|
||||||
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
@INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED@
|
||||||
|
|
||||||
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
|
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
|
||||||
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
|
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
|
||||||
SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
|
SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
# the following file has been configured from @CMAKE_TOOLCHAIN_FILE@
|
|
||||||
INCLUDE("@_OWN_DIR@/CMakeToolchainFile.cmake")
|
|
||||||
|
|
||||||
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
|
|
||||||
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
|
|
||||||
SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
|
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
|
|
||||||
|
|
||||||
SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
|
|
||||||
SET(CMAKE_HOST_SYSTEM_NAME "@CMAKE_HOST_SYSTEM_NAME@")
|
|
||||||
SET(CMAKE_HOST_SYSTEM_VERSION "@CMAKE_HOST_SYSTEM_VERSION@")
|
|
||||||
SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
|
|
||||||
SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
|
|
||||||
|
|
||||||
SET(CMAKE_SYSTEM_LOADED 1)
|
|
Loading…
Reference in New Issue