ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
|
|
|
|
# search for additional tools required for C/C++ (and other languages ?)
|
|
|
|
#
|
|
|
|
# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
|
|
|
|
# as prefix for the tools (e.g. arm-elf-gcc etc.)
|
|
|
|
# If the cmake variable _CMAKE_TOOLCHAIN_LOCATION is set, the compiler is
|
|
|
|
# searched only there. The other tools are at first searched there, then
|
|
|
|
# also in the default locations.
|
|
|
|
#
|
|
|
|
# Sets the following variables:
|
|
|
|
# CMAKE_AR
|
|
|
|
# CMAKE_RANLIB
|
|
|
|
# CMAKE_LINKER
|
|
|
|
# CMAKE_STRIP
|
|
|
|
# CMAKE_INSTALL_NAME_TOOL
|
|
|
|
|
|
|
|
# on UNIX, cygwin and mingw
|
2007-05-21 18:15:42 +04:00
|
|
|
|
|
|
|
|
|
|
|
# if it's the MS C/CXX compiler, search for link
|
2007-07-02 20:46:55 +04:00
|
|
|
IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
|
|
|
|
2007-05-21 18:15:42 +04:00
|
|
|
FIND_PROGRAM(CMAKE_LINKER NAMES link PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_LINKER NAMES link)
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(CMAKE_LINKER)
|
|
|
|
|
|
|
|
# in all other cases search for ar, ranlib, etc.
|
2007-07-02 20:46:55 +04:00
|
|
|
ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
2007-05-21 18:15:42 +04:00
|
|
|
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar)
|
|
|
|
|
|
|
|
FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib)
|
|
|
|
IF(NOT CMAKE_RANLIB)
|
|
|
|
SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
|
|
|
|
ENDIF(NOT CMAKE_RANLIB)
|
|
|
|
|
|
|
|
FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2007-08-15 22:26:00 +04:00
|
|
|
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)
|
|
|
|
|
2007-07-02 20:46:55 +04:00
|
|
|
ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
|
|
|
|
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
|
|
|
|
|
2007-05-21 18:15:42 +04:00
|
|
|
# on Apple there really should be install_name_tool
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
IF(APPLE)
|
|
|
|
FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool)
|
|
|
|
|
2007-05-18 00:49:31 +04:00
|
|
|
IF(NOT CMAKE_INSTALL_NAME_TOOL)
|
|
|
|
MESSAGE(FATAL_ERROR "Could not find install_name_tool, please check your installation.")
|
|
|
|
ENDIF(NOT CMAKE_INSTALL_NAME_TOOL)
|
|
|
|
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL)
|
|
|
|
ENDIF(APPLE)
|
|
|
|
|
2008-01-03 00:52:12 +03:00
|
|
|
# if we are on an ELF system, search for chrpath
|
2008-01-16 03:56:42 +03:00
|
|
|
# according to the binutils mailing list chrpath has problems when cross compiling
|
|
|
|
# i.e. if the target has different endianness than the host
|
2008-01-15 03:02:30 +03:00
|
|
|
IF("${CMAKE_EXECUTABLE_FORMAT}" STREQUAL "ELF" AND NOT CMAKE_CROSSCOMPILING)
|
2007-12-19 01:50:27 +03:00
|
|
|
# on ELF platforms there might be chrpath, which works similar to install_name_tool
|
2008-01-03 00:52:12 +03:00
|
|
|
OPTION(CMAKE_USE_CHRPATH "Enable this to use chrpath if available" OFF)
|
2007-12-19 01:50:27 +03:00
|
|
|
|
|
|
|
FIND_PROGRAM(CMAKE_CHRPATH chrpath PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_CHRPATH chrpath)
|
|
|
|
|
2008-01-22 04:57:23 +03:00
|
|
|
MARK_AS_ADVANCED(CMAKE_CHRPATH CMAKE_USE_CHRPATH)
|
2008-01-15 03:02:30 +03:00
|
|
|
ENDIF("${CMAKE_EXECUTABLE_FORMAT}" STREQUAL "ELF" AND NOT CMAKE_CROSSCOMPILING)
|