2009-09-28 19:46:51 +04:00
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2007-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:46:51 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2007-06-28 17:14:27 +04:00
|
|
|
# determine the compiler to use for ASM programs
|
|
|
|
|
|
|
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
# prefer the environment variable ASM
|
|
|
|
IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
|
|
|
|
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
|
|
|
|
|
|
|
# finally list compilers to try
|
2011-01-30 23:03:37 +03:00
|
|
|
IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
|
|
|
|
|
|
|
|
IF(CMAKE_ASM_COMPILER_INIT)
|
|
|
|
SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT})
|
|
|
|
ELSE(CMAKE_ASM_COMPILER_INIT)
|
|
|
|
|
2011-03-01 23:28:54 +03:00
|
|
|
IF(CMAKE_C_COMPILER)
|
2011-01-30 23:03:37 +03:00
|
|
|
SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
|
|
|
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
|
2011-03-01 23:39:19 +03:00
|
|
|
ELSEIF(CMAKE_CXX_COMPILER)
|
2011-01-30 23:03:37 +03:00
|
|
|
SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
|
|
|
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
|
2011-03-01 23:28:54 +03:00
|
|
|
ELSE(CMAKE_CXX_COMPILER)
|
2011-01-30 23:03:37 +03:00
|
|
|
# List all default C and CXX compilers
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc
|
|
|
|
${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
|
2011-03-01 23:28:54 +03:00
|
|
|
ENDIF(CMAKE_C_COMPILER)
|
2011-01-30 23:03:37 +03:00
|
|
|
|
|
|
|
ENDIF(CMAKE_ASM_COMPILER_INIT)
|
|
|
|
|
|
|
|
|
|
|
|
ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
|
|
|
|
|
|
|
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
|
|
|
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
|
|
|
MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
|
|
|
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
|
|
|
|
|
|
|
ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
|
|
|
|
2007-06-28 17:14:27 +04:00
|
|
|
|
|
|
|
# Find the compiler.
|
|
|
|
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
|
|
|
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH)
|
|
|
|
ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
2008-11-06 01:27:41 +03:00
|
|
|
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
|
2007-06-28 17:14:27 +04:00
|
|
|
|
|
|
|
ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
|
2009-09-26 13:20:03 +04:00
|
|
|
# we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
2007-06-28 17:14:27 +04:00
|
|
|
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
|
|
|
#
|
2010-08-15 18:08:54 +04:00
|
|
|
# if a compiler was specified by the user but without path,
|
2007-06-28 17:14:27 +04:00
|
|
|
# now try to find it with the full path
|
2010-08-15 18:08:54 +04:00
|
|
|
# if it is found, force it into the cache,
|
2007-06-28 17:14:27 +04:00
|
|
|
# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
|
2008-04-22 02:51:55 +04:00
|
|
|
GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
|
|
|
IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
|
2007-06-28 17:14:27 +04:00
|
|
|
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
|
|
|
|
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
|
|
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
|
|
|
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
|
|
|
ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
|
|
|
|
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
|
|
|
|
IF (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
|
|
|
GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
|
|
|
ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
|
|
|
|
2010-08-15 18:36:38 +04:00
|
|
|
|
|
|
|
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
|
|
|
|
|
|
# Table of per-vendor compiler id flags with expected output.
|
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
2011-03-02 00:58:26 +03:00
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
|
2011-01-30 23:03:37 +03:00
|
|
|
|
2011-02-12 12:33:39 +03:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C")
|
|
|
|
|
2011-01-30 23:14:53 +03:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
|
|
|
|
|
2011-02-09 00:23:54 +03:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
|
|
|
|
|
2011-02-12 12:24:24 +03:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
|
|
|
|
|
2011-10-06 19:57:32 +04:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft")
|
|
|
|
|
2010-12-28 20:15:47 +03:00
|
|
|
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP )
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
|
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
|
2010-08-15 18:36:38 +04:00
|
|
|
|
2010-11-18 01:01:36 +03:00
|
|
|
INCLUDE(CMakeDetermineCompilerId)
|
2010-08-15 18:36:38 +04:00
|
|
|
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
2011-03-02 00:58:26 +03:00
|
|
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
|
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
|
|
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
|
|
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
|
|
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
|
|
|
|
|
|
|
|
2010-08-15 18:36:38 +04:00
|
|
|
|
2010-08-15 18:08:54 +04:00
|
|
|
# If we have a gas/as cross compiler, they have usually some prefix, like
|
2011-01-26 22:52:34 +03:00
|
|
|
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
|
|
|
|
# with a 3-component version number at the end
|
2008-05-15 20:07:43 +04:00
|
|
|
# The other tools of the toolchain usually have the same prefix
|
|
|
|
# NAME_WE cannot be used since then this test will fail for names lile
|
2010-08-15 18:08:54 +04:00
|
|
|
# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be
|
2008-05-15 20:07:43 +04:00
|
|
|
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
2007-06-28 17:14:27 +04:00
|
|
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
2008-05-15 20:07:43 +04:00
|
|
|
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
2011-01-26 22:52:34 +03:00
|
|
|
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
2011-01-30 23:03:37 +03:00
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
2011-01-26 22:52:34 +03:00
|
|
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
2007-06-28 17:14:27 +04:00
|
|
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
|
|
|
|
2011-01-30 23:03:37 +03:00
|
|
|
# Now try the C compiler regexp:
|
|
|
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
|
|
|
IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
|
|
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
|
|
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
|
|
|
|
|
|
|
# Finally try the CXX compiler regexp:
|
|
|
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
|
|
|
IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
|
|
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
|
|
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
|
|
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
|
|
|
|
|
|
|
|
2007-06-28 17:14:27 +04:00
|
|
|
INCLUDE(CMakeFindBinUtils)
|
|
|
|
|
2009-09-26 13:20:03 +04:00
|
|
|
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
|
2007-06-28 17:14:27 +04:00
|
|
|
|
|
|
|
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
MESSAGE(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
|
|
|
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
MESSAGE(STATUS "Didn't find assembler")
|
|
|
|
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
|
|
|
|
|
|
|
|
|
|
|
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
2011-01-30 23:03:37 +03:00
|
|
|
SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
2007-06-28 17:14:27 +04:00
|
|
|
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
|
|
|
|
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
|
|
|
|
|
|
|
|
# configure variables set in this file for fast reload later on
|
2010-08-15 18:08:54 +04:00
|
|
|
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
|
2007-06-28 17:14:27 +04:00
|
|
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
SET(_CMAKE_ASM_COMPILER)
|
|
|
|
SET(_CMAKE_ASM_COMPILER_ARG1)
|
|
|
|
SET(_CMAKE_ASM_COMPILER_ENV_VAR)
|